mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Minesweeper: Allow single-click chording
This is how other Minesweeper games I've played usually behave. Single-click chording can be disabled from the menu or config file.
This commit is contained in:
parent
d2b6f79835
commit
9dbf453015
3 changed files with 26 additions and 2 deletions
|
@ -43,8 +43,9 @@ public:
|
|||
|
||||
virtual void mousedown_event(GMouseEvent& event) override
|
||||
{
|
||||
if (event.buttons() == (GMouseButton::Right | GMouseButton::Left)) {
|
||||
if (event.button() == GMouseButton::Left || event.button() == GMouseButton::Right) {
|
||||
if (event.button() == GMouseButton::Right || event.button() == GMouseButton::Left) {
|
||||
if (event.buttons() == (GMouseButton::Right | GMouseButton::Left) ||
|
||||
m_square.field->is_single_chording()) {
|
||||
m_chord = true;
|
||||
m_square.field->set_chord_preview(m_square, true);
|
||||
}
|
||||
|
@ -461,6 +462,12 @@ void Field::set_field_size(int rows, int columns, int mine_count)
|
|||
on_size_changed();
|
||||
}
|
||||
|
||||
void Field::set_single_chording(bool enabled) {
|
||||
auto config = CConfigFile::get_for_app("Minesweeper");
|
||||
m_single_chording = enabled;
|
||||
config->write_bool_entry("Minesweeper", "SingleChording", m_single_chording);
|
||||
}
|
||||
|
||||
Square::~Square()
|
||||
{
|
||||
delete label;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue