FlappyBug: Propagate errors in Cloud class

Move-construct Cloud into the Game class to improve
error handling.
This commit is contained in:
creator1creeper1 2021-12-23 22:29:00 +01:00 committed by Brian Gianforcaro
commit 6f592a32cc
Notes: sideshowbarker 2024-07-17 22:18:46 +09:00
3 changed files with 19 additions and 9 deletions

View file

@ -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>(TRY(FlappyBug::Game::Bug::construct())));
auto widget = TRY(window->try_set_main_widget<FlappyBug::Game>(TRY(FlappyBug::Game::Bug::construct()), TRY(FlappyBug::Game::Cloud::construct())));
widget->on_game_end = [&](u32 score) {
if (score <= high_score)