1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 14:45:08 +00:00

Minesweeper: Fix lag when changing the field size.

Use a number of techniques to avoid freezing the UI for too long.

- Keep reusing the same widgets for the squares once they've been created.
- Temporarily disable widget updates.
- Avoid some redundant work on each run of reset().
This commit is contained in:
Andreas Kling 2019-05-02 04:21:21 +02:00
parent 49d0cdabac
commit 13b8c7eab8
2 changed files with 43 additions and 27 deletions

View file

@ -77,6 +77,9 @@ int main(int argc, char** argv)
game_menu->add_action(GAction::create("Expert", { Mod_Ctrl, Key_E }, [field] (const GAction&) {
field->set_field_size(16, 30, 99);
}));
game_menu->add_action(GAction::create("Madwoman", { Mod_Ctrl, Key_M }, [field] (const GAction&) {
field->set_field_size(32, 60, 350);
}));
menubar->add_menu(move(game_menu));
auto help_menu = make<GMenu>("Help");