1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-31 20:02:44 +00:00

Chess: Added ability to resign and flip the board

This patch adds options to the app's menubar to resign the game and
flip the board.
This commit is contained in:
AnicJov 2020-12-04 13:17:00 +01:00 committed by Andreas Kling
parent 694f68ab86
commit 01b62cc7f4
5 changed files with 76 additions and 0 deletions

View file

@ -85,6 +85,14 @@ int main(int argc, char** argv)
auto menubar = GUI::MenuBar::construct();
auto& app_menu = menubar->add_menu("Chess");
app_menu.add_action(GUI::Action::create("Resign", { Mod_None, Key_F3 }, [&](auto&) {
widget.resign();
}));
app_menu.add_action(GUI::Action::create("Flip Board", { Mod_None, Key_F4 }, [&](auto&) {
widget.flip_board();
}));
app_menu.add_separator();
app_menu.add_action(GUI::Action::create("New game", { Mod_None, Key_F2 }, [&](auto&) {
widget.reset();
}));