From b55c9f6bbac562215fa5c078757de8fd235f82d0 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 18 Feb 2021 00:07:10 +0100 Subject: [PATCH] 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. --- Userland/Games/Conway/Game.h | 3 +++ Userland/Games/Conway/main.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/Userland/Games/Conway/Game.h b/Userland/Games/Conway/Game.h index effaca315f..29ff2ed56c 100644 --- a/Userland/Games/Conway/Game.h +++ b/Userland/Games/Conway/Game.h @@ -34,6 +34,9 @@ public: virtual ~Game() override; void reset(); + int rows() const { return m_rows; }; + int columns() const { return m_columns; }; + private: Game(); virtual void paint_event(GUI::PaintEvent&) override; diff --git a/Userland/Games/Conway/main.cpp b/Userland/Games/Conway/main.cpp index 317674b86a..d266d3bfdb 100644 --- a/Userland/Games/Conway/main.cpp +++ b/Userland/Games/Conway/main.cpp @@ -66,6 +66,7 @@ int main(int argc, char** argv) window->set_icon(app_icon.bitmap_for_size(16)); auto& game = window->set_main_widget(); + window->set_minimum_size(game.columns(), game.rows()); auto menubar = GUI::MenuBar::construct();