summary refs log tree commit diff stats
path: root/src/world.cpp
blob: 90d9ab884ad232c684bb8a2b60d16faf909fb76b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "world.h"

void World::tick()
{
  for (auto it = entities.begin(); it != entities.end(); it++)
  {
    (*it)->tick();
  }
}

void World::input(int key, int action)
{
  for (auto it = entities.begin(); it != entities.end(); it++)
  {
    (*it)->input(key, action);
  }
}

void World::render(Texture* buffer)
{
  fillTexture(buffer, NULL, 0, 0, 0);
  
  for (auto it = entities.begin(); it != entities.end(); it++)
  {
    (*it)->render(buffer);
  }
}

void World::addEntity(std::shared_ptr<Entity> e)
{
  entities.push_back(e);
}