mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
Minesweeper: Move configuration reading to Field
This makes more sense as it's where configuration writing happens.
This commit is contained in:
parent
9dbf453015
commit
eb4c42bfa8
3 changed files with 20 additions and 24 deletions
|
@ -36,7 +36,7 @@ class Field final : public GFrame {
|
|||
friend class SquareLabel;
|
||||
|
||||
public:
|
||||
Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidget* parent);
|
||||
Field(GLabel& flag_label, GLabel& time_label, GButton& face_button, GWidget* parent, Function<void(Size)> on_size_changed);
|
||||
virtual ~Field() override;
|
||||
|
||||
int rows() const { return m_rows; }
|
||||
|
@ -50,8 +50,6 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
Function<void()> on_size_changed;
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
|
@ -80,9 +78,9 @@ private:
|
|||
};
|
||||
void set_face(Face);
|
||||
|
||||
int m_rows { 9 };
|
||||
int m_columns { 9 };
|
||||
int m_mine_count { 10 };
|
||||
int m_rows { 0 };
|
||||
int m_columns { 0 };
|
||||
int m_mine_count { 0 };
|
||||
int m_unswept_empties { 0 };
|
||||
Vector<OwnPtr<Square>> m_squares;
|
||||
RefPtr<GraphicsBitmap> m_mine_bitmap;
|
||||
|
@ -103,4 +101,5 @@ private:
|
|||
bool m_chord_preview { false };
|
||||
bool m_first_click { true };
|
||||
bool m_single_chording { true };
|
||||
Function<void(Size)> m_on_size_changed;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue