summary refs log tree commit diff stats
path: root/src/entity.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-07 11:29:57 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-07 11:29:57 -0500
commitb53826079429939cdfbda073608cb85be8ba0738 (patch)
tree3c40de4658f0cea01cd3938f07fe82788ef3dd01 /src/entity.cpp
parent0751446e1d069263d25abcff49a32a380231709a (diff)
downloadtherapy-b53826079429939cdfbda073608cb85be8ba0738.tar.gz
therapy-b53826079429939cdfbda073608cb85be8ba0738.tar.bz2
therapy-b53826079429939cdfbda073608cb85be8ba0738.zip
Created entity-component system
Also tweaked the bloom flicker, tweaked the scanline texture, created a second test map, and created some currently unused sound effects.
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/entity.cpp b/src/entity.cpp new file mode 100644 index 0000000..405de24 --- /dev/null +++ b/src/entity.cpp
@@ -0,0 +1,38 @@
1#include "entity.h"
2
3void Entity::addComponent(std::shared_ptr<Component> c)
4{
5 components.push_back(c);
6}
7
8void Entity::send(message_t msg)
9{
10 for (auto it = components.begin(); it != components.end(); it++)
11 {
12 (*it)->receive(msg);
13 }
14}
15
16void Entity::tick()
17{
18 for (auto it = components.begin(); it != components.end(); it++)
19 {
20 (*it)->tick();
21 }
22}
23
24void Entity::input(int key, int action)
25{
26 for (auto it = components.begin(); it != components.end(); it++)
27 {
28 (*it)->input(key, action);
29 }
30}
31
32void Entity::render(Texture* buffer)
33{
34 for (auto it = components.begin(); it != components.end(); it++)
35 {
36 (*it)->render(buffer);
37 }
38}