]> git.tdb.fi Git - libs/game.git/blobdiff - examples/bassteroids/source/gamecontroller.h
Begin creating an example game
[libs/game.git] / examples / bassteroids / source / gamecontroller.h
diff --git a/examples/bassteroids/source/gamecontroller.h b/examples/bassteroids/source/gamecontroller.h
new file mode 100644 (file)
index 0000000..1f0d3cf
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef GAMECONTROLLER_H_
+#define GAMECONTROLLER_H_
+
+#include <random>
+#include <msp/game/system.h>
+#include "asteroid.h"
+
+class GameController: public Msp::Game::System
+{
+private:
+       enum State
+       {
+               LEVEL_START,
+               PLAYING
+       };
+
+       std::minstd_rand rng;
+       AsteroidSetup asteroid_setup;
+       State state = LEVEL_START;
+       unsigned level = 1;
+       std::vector<Msp::Game::Owned<Asteroid>> asteroids;
+
+public:
+       GameController(Msp::Game::Stage &);
+
+       void tick(Msp::Time::TimeDelta) override;
+};
+
+#endif