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:
parent
b32f5dbcff
commit
2069a5a2a0
3 changed files with 11 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue