1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

Snake: Make initialization from GML fallible

Replace the C_OBJECT factory functions with a custom try_create() which
loads the various bitmaps. Any failures there are now propagated.
This commit is contained in:
Sam Atkins 2022-12-29 17:31:34 +00:00 committed by Tim Flynn
parent b32f5dbcff
commit 2069a5a2a0
3 changed files with 11 additions and 9 deletions

View file

@ -49,7 +49,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->resize(324, 345);
auto widget = TRY(window->try_set_main_widget<GUI::Widget>());
widget->load_from_gml(snake_gml);
TRY(widget->try_load_from_gml(snake_gml));
auto& game = *widget->find_descendant_of_type_named<Snake::Game>("game");
game.set_focus(true);