mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Snake: Show status tips in Statusbar
This commit is contained in:
parent
46f365df5c
commit
b264d29515
Notes:
sideshowbarker
2024-07-17 07:31:31 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/b264d29515 Pull-request: https://github.com/SerenityOS/serenity/pull/19441
1 changed files with 6 additions and 0 deletions
|
@ -64,6 +64,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& statusbar = *widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar"sv);
|
||||
statusbar.set_text(0, TRY("Score: 0"_string));
|
||||
statusbar.set_text(1, TRY(String::formatted("High Score: {}", high_score)));
|
||||
GUI::Application::the()->on_action_enter = [&statusbar](GUI::Action& action) {
|
||||
statusbar.set_override_text(action.status_tip());
|
||||
};
|
||||
GUI::Application::the()->on_action_leave = [&statusbar](GUI::Action&) {
|
||||
statusbar.set_override_text({});
|
||||
};
|
||||
|
||||
game.on_score_update = [&](auto score) {
|
||||
statusbar.set_text(0, String::formatted("Score: {}", score).release_value_but_fixme_should_propagate_errors());
|
||||
|
|
Loading…
Reference in a new issue