summary refs log tree commit diff stats
path: root/src/entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp46
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
3void Entity::addComponent(std::shared_ptr<Component> c)
4{
5 components.push_back(c);
6}
7
8void Entity::send(Game& game, const Message& msg)
9{
10 for (auto component : components)
11 {
12 component->receive(game, *this, msg);
13 }
14}
15
16void Entity::tick(Game& game, double dt)
17{
18 for (auto component : components)
19 {
20 component->tick(game, *this, dt);
21 }
22}
23
24void 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
32void Entity::render(Game& game, Texture& buffer)
33{
34 for (auto component : components)
35 {
36 component->render(game, *this, buffer);
37 }
38}
39
40void 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}