diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-06-11 11:38:49 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-06-11 11:38:49 -0400 |
| commit | 879c2c04d9c3879f871cfe79f9b25fd23c5184b4 (patch) | |
| tree | 70bf8773b18478af58ecd0877b6bb62a7279c094 /src/entity.cpp | |
| parent | 11f4af82626b0e35c35606b327e4181c7c88f228 (diff) | |
| download | therapy-879c2c04d9c3879f871cfe79f9b25fd23c5184b4.tar.gz therapy-879c2c04d9c3879f871cfe79f9b25fd23c5184b4.tar.bz2 therapy-879c2c04d9c3879f871cfe79f9b25fd23c5184b4.zip | |
Wrote EntityManager
Diffstat (limited to 'src/entity.cpp')
| -rw-r--r-- | src/entity.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
| diff --git a/src/entity.cpp b/src/entity.cpp deleted file mode 100644 index 2b6cd7f..0000000 --- a/src/entity.cpp +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | #include "entity.h" | ||
| 2 | |||
| 3 | void Entity::addComponent(std::shared_ptr<Component> c) | ||
| 4 | { | ||
| 5 | components.push_back(c); | ||
| 6 | } | ||
| 7 | |||
| 8 | void Entity::send(Game& game, const Message& msg) | ||
| 9 | { | ||
| 10 | for (auto component : components) | ||
| 11 | { | ||
| 12 | component->receive(game, *this, msg); | ||
| 13 | } | ||
| 14 | } | ||
| 15 | |||
| 16 | void Entity::tick(Game& game, double dt) | ||
| 17 | { | ||
| 18 | for (auto component : components) | ||
| 19 | { | ||
| 20 | component->tick(game, *this, dt); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | void Entity::input(Game& game, int key, int action) | ||
| 25 | { | ||
| 26 | for (auto component : components) | ||
| 27 | { | ||
| 28 | component->input(game, *this, key, action); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | void Entity::render(Game& game, Texture& buffer) | ||
| 33 | { | ||
| 34 | for (auto component : components) | ||
| 35 | { | ||
| 36 | component->render(game, *this, buffer); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | void Entity::detectCollision(Game& game, Entity& collider, std::pair<double, double> old_position) | ||
| 41 | { | ||
| 42 | for (auto component : components) | ||
| 43 | { | ||
| 44 | component->detectCollision(game, *this, collider, old_position); | ||
| 45 | } | ||
| 46 | } | ||
