]> git.tdb.fi Git - libs/game.git/blob - examples/bassteroids/source/physicalentity.h
Add playfield boundaries to Bassteroids
[libs/game.git] / examples / bassteroids / source / physicalentity.h
1 #ifndef PHYSICALENTITY_H_
2 #define PHYSICALENTITY_H_
3
4 #include <msp/game/entity.h>
5 #include <msp/game/transform.h>
6 #include "rigidbody.h"
7 #include "collider.h"
8
9 struct PhysicalSetup
10 {
11         bool fixture = false;
12         RigidBodySetup body;
13         ColliderSetup collider;
14 };
15
16 class PhysicalEntity: public Msp::Game::Entity
17 {
18 public:
19         using Setup = PhysicalSetup;
20
21 protected:
22         Msp::Game::Owned<RigidBody> body;
23         Msp::Game::Owned<Collider> collider;
24
25 public:
26         PhysicalEntity(Msp::Game::Handle<Msp::Game::Entity>, const Setup &, const Msp::Game::TransformValues & = Msp::Game::TransformValues());
27
28         bool is_fixture() const { return !body; }
29         Msp::Game::Handle<RigidBody> get_body() const { return body; }
30         Msp::Game::Handle<Collider> get_collider() const { return collider; }
31 };
32
33 #endif