From b53826079429939cdfbda073608cb85be8ba0738 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 7 Mar 2015 11:29:57 -0500 Subject: 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. --- src/entity.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/entity.cpp (limited to 'src/entity.cpp') 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 @@ +#include "entity.h" + +void Entity::addComponent(std::shared_ptr c) +{ + components.push_back(c); +} + +void Entity::send(message_t msg) +{ + for (auto it = components.begin(); it != components.end(); it++) + { + (*it)->receive(msg); + } +} + +void Entity::tick() +{ + for (auto it = components.begin(); it != components.end(); it++) + { + (*it)->tick(); + } +} + +void Entity::input(int key, int action) +{ + for (auto it = components.begin(); it != components.end(); it++) + { + (*it)->input(key, action); + } +} + +void Entity::render(Texture* buffer) +{ + for (auto it = components.begin(); it != components.end(); it++) + { + (*it)->render(buffer); + } +} -- cgit 1.4.1