mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
FlappyBug: TRY() all the things in serenity_main() :^)
This commit is contained in:
parent
45e29d58e2
commit
2f5f53d1cf
1 changed files with 7 additions and 7 deletions
|
@ -37,9 +37,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
window->set_title("Flappy Bug");
|
window->set_title("Flappy Bug");
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_resizable(false);
|
window->set_resizable(false);
|
||||||
auto& widget = window->set_main_widget<FlappyBug::Game>();
|
auto widget = TRY(window->try_set_main_widget<FlappyBug::Game>());
|
||||||
|
|
||||||
widget.on_game_end = [&](u32 score) {
|
widget->on_game_end = [&](u32 score) {
|
||||||
if (score <= high_score)
|
if (score <= high_score)
|
||||||
return high_score;
|
return high_score;
|
||||||
|
|
||||||
|
@ -49,13 +49,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
return high_score;
|
return high_score;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto& game_menu = window->add_menu("&Game");
|
auto game_menu = TRY(window->try_add_menu("&Game"));
|
||||||
game_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||||
GUI::Application::the()->quit();
|
GUI::Application::the()->quit();
|
||||||
}));
|
})));
|
||||||
|
|
||||||
auto& help_menu = window->add_menu("&Help");
|
auto help_menu = TRY(window->try_add_menu("&Help"));
|
||||||
help_menu.add_action(GUI::CommonActions::make_about_action("Flappy Bug", app_icon, window));
|
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Flappy Bug", app_icon, window)));
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue