mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
FlappyBug: Propagate errors in Bug class
Move-construct Bug into the Game class to improve error handling.
This commit is contained in:
parent
a67afa735c
commit
ff359c27e3
3 changed files with 21 additions and 5 deletions
|
@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
window->set_title("Flappy Bug");
|
||||
window->set_double_buffering_enabled(false);
|
||||
window->set_resizable(false);
|
||||
auto widget = TRY(window->try_set_main_widget<FlappyBug::Game>());
|
||||
auto widget = TRY(window->try_set_main_widget<FlappyBug::Game>(TRY(FlappyBug::Game::Bug::construct())));
|
||||
|
||||
widget->on_game_end = [&](u32 score) {
|
||||
if (score <= high_score)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue