]> git.tdb.fi Git - libs/game.git/blob - examples/bassteroids/source/gamecontroller.h
Load the various setups through resources
[libs/game.git] / examples / bassteroids / source / gamecontroller.h
1 #ifndef GAMECONTROLLER_H_
2 #define GAMECONTROLLER_H_
3
4 #include <random>
5 #include <msp/game/system.h>
6 #include "asteroid.h"
7
8 class GameController: public Msp::Game::System
9 {
10 private:
11         enum State
12         {
13                 LEVEL_START,
14                 PLAYING
15         };
16
17         std::minstd_rand rng;
18         const AsteroidSetup &asteroid_setup;
19         State state = LEVEL_START;
20         unsigned level = 1;
21         std::vector<Msp::Game::Owned<Asteroid>> asteroids;
22
23 public:
24         GameController(Msp::Game::Stage &);
25
26         void tick(Msp::Time::TimeDelta) override;
27         void deferred_tick() override;
28 };
29
30 #endif