mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
BrickGame: Remember the "Show Shadow Piece" setting between executions
by using the ConfigServer.
This commit is contained in:
parent
439076df8a
commit
f532f9d279
3 changed files with 12 additions and 2 deletions
|
@ -59,10 +59,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(game_menu->try_add_action(GUI::Action::create("Toggle &Pause", { Mod_None, Key_P }, [&](auto&) {
|
||||
game->toggle_pause();
|
||||
})));
|
||||
auto show_shadow_piece_action = TRY(GUI::Action::try_create_checkable("&Show Shadow Piece", GUI::Shortcut {}, [&](auto& action) {
|
||||
|
||||
auto show_shadow_piece_action = TRY(GUI::Action::try_create_checkable("Show Shadow Piece", GUI::Shortcut {}, [&](auto& action) {
|
||||
game->set_show_shadow_hint(action.is_checked());
|
||||
Config::write_bool(app_name, app_name, "ShowShadowPiece"sv, action.is_checked());
|
||||
}));
|
||||
show_shadow_piece_action->set_checked(true);
|
||||
game->set_show_shadow_hint(Config::read_bool(app_name, app_name, "ShowShadowPiece"sv, true));
|
||||
show_shadow_piece_action->set_checked(game->show_shadow_hint());
|
||||
|
||||
TRY(game_menu->try_add_action(show_shadow_piece_action));
|
||||
TRY(game_menu->try_add_separator());
|
||||
TRY(game_menu->try_add_action(GUI::CommonActions::make_quit_action([](auto&) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue