1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

GameOfLife: Add choosable patterns

This commit is contained in:
Ryan Wilson 2021-05-22 05:54:58 -03:00 committed by GitHub
parent b808815e57
commit 1965d60aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 309 additions and 7 deletions

View file

@ -15,6 +15,7 @@
#include <LibGUI/SpinBox.h>
#include <LibGUI/Statusbar.h>
#include <LibGUI/Toolbar.h>
#include <LibGUI/ToolbarContainer.h>
#include <LibGUI/Window.h>
const char* click_tip = "Tip: click the board to toggle individual cells, or click+drag to toggle multiple cells";
@ -102,6 +103,12 @@ int main(int argc, char** argv)
});
main_toolbar.add_action(randomize_cells_action);
auto rotate_pattern_action = GUI::Action::create("&Rotate pattern", { 0, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"), [&](auto&) {
if (board_widget.selected_pattern() != nullptr)
board_widget.selected_pattern()->rotate_clockwise();
});
main_toolbar.add_action(rotate_pattern_action);
auto menubar = GUI::Menubar::construct();
auto& game_menu = menubar->add_menu("&Game");