mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 12:57:36 +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
80
Userland/Games/Minesweeper/MinesweeperCustomGameWindow.gml
Normal file
80
Userland/Games/Minesweeper/MinesweeperCustomGameWindow.gml
Normal file
|
@ -0,0 +1,80 @@
|
|||
@GUI::Widget {
|
||||
fill_with_background_color: true
|
||||
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [4]
|
||||
}
|
||||
|
||||
@GUI::GroupBox {
|
||||
title: "Field"
|
||||
autosize: true
|
||||
|
||||
layout: @GUI::HorizontalBoxLayout {
|
||||
margins: [16, 6, 6]
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
text: "Columns: "
|
||||
autosize: true
|
||||
}
|
||||
|
||||
@GUI::SpinBox {
|
||||
name: "columns_spinbox"
|
||||
min: 10
|
||||
max: 50
|
||||
fixed_width: 40
|
||||
}
|
||||
|
||||
@GUI::VerticalSeparator {
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
text: "Rows: "
|
||||
autosize: true
|
||||
}
|
||||
|
||||
@GUI::SpinBox {
|
||||
name: "rows_spinbox"
|
||||
min: 10
|
||||
max: 50
|
||||
fixed_width: 40
|
||||
}
|
||||
|
||||
@GUI::VerticalSeparator {
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
text: "Mines: "
|
||||
autosize: true
|
||||
}
|
||||
|
||||
@GUI::SpinBox {
|
||||
name: "mines_spinbox"
|
||||
min: 1
|
||||
max: 2500
|
||||
fixed_width: 50
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
max_height: 24
|
||||
|
||||
layout: @GUI::HorizontalBoxLayout {
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "ok_button"
|
||||
text: "OK"
|
||||
max_width: 75
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "cancel_button"
|
||||
text: "Cancel"
|
||||
max_width: 75
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue