mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:17:45 +00:00
Snake: Convert the game window to GML
Unfortunately, GML widget registration requires a non-fallible construct method to create the widget. So this does a bit of manual error checking when loading the food bitmaps.
This commit is contained in:
parent
ae90f490bd
commit
cb66c02bc4
5 changed files with 79 additions and 44 deletions
|
@ -17,7 +17,6 @@ class Game : public GUI::Frame {
|
|||
C_OBJECT(Game);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Game>> create();
|
||||
virtual ~Game() override = default;
|
||||
|
||||
void start();
|
||||
|
@ -27,7 +26,7 @@ public:
|
|||
void set_snake_base_color(Color color);
|
||||
|
||||
private:
|
||||
explicit Game(NonnullRefPtrVector<Gfx::Bitmap> food_bitmaps);
|
||||
Game();
|
||||
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue