diff options
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/world.cpp b/src/world.cpp new file mode 100644 index 0000000..90d9ab8 --- /dev/null +++ b/src/world.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | #include "world.h" | ||
2 | |||
3 | void World::tick() | ||
4 | { | ||
5 | for (auto it = entities.begin(); it != entities.end(); it++) | ||
6 | { | ||
7 | (*it)->tick(); | ||
8 | } | ||
9 | } | ||
10 | |||
11 | void World::input(int key, int action) | ||
12 | { | ||
13 | for (auto it = entities.begin(); it != entities.end(); it++) | ||
14 | { | ||
15 | (*it)->input(key, action); | ||
16 | } | ||
17 | } | ||
18 | |||
19 | void World::render(Texture* buffer) | ||
20 | { | ||
21 | fillTexture(buffer, NULL, 0, 0, 0); | ||
22 | |||
23 | for (auto it = entities.begin(); it != entities.end(); it++) | ||
24 | { | ||
25 | (*it)->render(buffer); | ||
26 | } | ||
27 | } | ||
28 | |||
29 | void World::addEntity(std::shared_ptr<Entity> e) | ||
30 | { | ||
31 | entities.push_back(e); | ||
32 | } | ||