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

Snake: Make a factory function for SnakeGame and propagate errors

This fixes a whopping 29 FIXMEs. :^)
This commit is contained in:
Andreas Kling 2022-12-13 16:29:15 +01:00 committed by Linus Groh
parent 781e3aea8b
commit ddb22cf10d
3 changed files with 42 additions and 33 deletions

View file

@ -15,12 +15,14 @@ class SnakeGame : public GUI::Frame {
C_OBJECT(SnakeGame);
public:
static ErrorOr<NonnullRefPtr<SnakeGame>> create();
virtual ~SnakeGame() override = default;
void reset();
private:
SnakeGame();
explicit SnakeGame(NonnullRefPtrVector<Gfx::Bitmap> food_bitmaps);
virtual void paint_event(GUI::PaintEvent&) override;
virtual void keydown_event(GUI::KeyEvent&) override;
virtual void timer_event(Core::TimerEvent&) override;