1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:27:45 +00:00

Conway: Set minumum window size to game columns x rows

The game renders no cells when the game widget height is < rows or width
is < columns, so let's set a minimum window size here.
This commit is contained in:
Linus Groh 2021-02-18 00:07:10 +01:00 committed by Andreas Kling
parent cfb0f3309d
commit b55c9f6bba
2 changed files with 4 additions and 0 deletions

View file

@ -34,6 +34,9 @@ public:
virtual ~Game() override; virtual ~Game() override;
void reset(); void reset();
int rows() const { return m_rows; };
int columns() const { return m_columns; };
private: private:
Game(); Game();
virtual void paint_event(GUI::PaintEvent&) override; virtual void paint_event(GUI::PaintEvent&) override;

View file

@ -66,6 +66,7 @@ int main(int argc, char** argv)
window->set_icon(app_icon.bitmap_for_size(16)); window->set_icon(app_icon.bitmap_for_size(16));
auto& game = window->set_main_widget<Game>(); auto& game = window->set_main_widget<Game>();
window->set_minimum_size(game.columns(), game.rows());
auto menubar = GUI::MenuBar::construct(); auto menubar = GUI::MenuBar::construct();