mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
Snake: Show status tips in Statusbar
This commit is contained in:
parent
46f365df5c
commit
b264d29515
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…
Add table
Add a link
Reference in a new issue