]> git.tdb.fi Git - libs/game.git/blobdiff - examples/bassteroids/source/playfield.h
Add playfield boundaries to Bassteroids
[libs/game.git] / examples / bassteroids / source / playfield.h
diff --git a/examples/bassteroids/source/playfield.h b/examples/bassteroids/source/playfield.h
new file mode 100644 (file)
index 0000000..10596e9
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef PLAYFIELD_H_
+#define PLAYFIELD_H_
+
+#include <msp/game/entity.h>
+#include "physicalentity.h"
+
+struct PlayfieldSetup
+{
+       Msp::LinAl::Vector<float, 2> size;
+};
+
+class Playfield: public Msp::Game::Entity
+{
+public:
+       using Setup = PlayfieldSetup;
+
+private:
+       struct Border
+       {
+               PhysicalSetup setup;
+               Msp::Game::Owned<PhysicalEntity> entity;
+
+               Border(Playfield &, Msp::LinAl::Vector<float, 2>, Msp::LinAl::Vector<float, 2>);
+       };
+
+       const Setup &setup;
+       Border left;
+       Border right;
+       Border bottom;
+       Border top;
+
+public:
+       Playfield(Msp::Game::Handle<Msp::Game::Entity>, const Setup &);
+};
+
+#endif