mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
Minesweeper: Add "Custom game..." difficulty
This adds a dialog window which allows us to customize the size of the board and the amount of mines that will be placed. The current max amount of mines is 50% of the total number of cells due to the fact that the generator algorithm takes too long to create a board for higher percentages of mines.
This commit is contained in:
parent
42071f69cf
commit
557075465c
5 changed files with 201 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "CustomGameDialog.h"
|
||||
#include "Field.h"
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibGUI/Action.h>
|
||||
|
@ -131,6 +132,10 @@ int main(int argc, char** argv)
|
|||
difficulty_menu.add_action(GUI::Action::create("&Madwoman", { Mod_Ctrl, Key_M }, [&](auto&) {
|
||||
field.set_field_size(32, 60, 350);
|
||||
}));
|
||||
difficulty_menu.add_separator();
|
||||
difficulty_menu.add_action(GUI::Action::create("&Custom game...", { Mod_Ctrl, Key_C }, [&](auto&) {
|
||||
CustomGameDialog::show(window, field);
|
||||
}));
|
||||
|
||||
auto& help_menu = window->add_menu("&Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Minesweeper", app_icon, window));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue