1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37:34 +00:00

Minesweeper: Simplify resizing game window

Instead of propagating field size changes to main and manually
calculating window size, use auto shrink to automatically
resize the window after changes to the board.
This commit is contained in:
thankyouverycool 2023-04-16 18:35:29 -04:00 committed by Andreas Kling
parent 76d17e6a8e
commit 5bb9af8297
3 changed files with 7 additions and 17 deletions

View file

@ -44,7 +44,7 @@ class Field final : public GUI::Frame {
friend class SquareLabel;
public:
static ErrorOr<NonnullRefPtr<Field>> create(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
static ErrorOr<NonnullRefPtr<Field>> create(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button);
virtual ~Field() override = default;
enum class Difficulty {
@ -109,7 +109,7 @@ public:
void generate_field(size_t start_row, size_t start_column);
private:
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button, Function<void(Gfx::IntSize)> on_size_changed);
Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_button);
void initialize();
@ -166,5 +166,4 @@ private:
bool m_chord_preview { false };
bool m_first_click { true };
bool m_single_chording { true };
Function<void(Gfx::IntSize)> m_on_size_changed;
};