5 #include "../graphics/Vector.h"
18 World(Vector<int> size);
21 Vector<int> Size() const { return size; }
22 Vector<int> TileSize() const { return Vector<int>(1, 1); }
25 void Update(float dt);
27 bool InBounds(Vector<int> pos) const
28 { return pos.x > 0 && pos.y > 0 && pos.x < size.x && pos.y < size.y; }
29 int Index(Vector<int> pos) const { return pos.y * size.x + pos.x; }
31 Tile &TileAt(Vector<int> pos) { return tiles[Index(pos)]; }
32 const Tile &TileAt(Vector<int> pos) const { return tiles[Index(pos)]; }
33 void SetTile(Vector<int> pos, const Tile &t) { tiles[Index(pos)] = t; }
35 const std::list<Entity *> &Entities() const { return entities; }
36 void AddEntity(Entity &e) { entities.push_back(&e); }
39 void BoundsCollision(Entity &, float dt);
40 void TileCollision(Entity &, float dt);
41 void EntityCollision();
47 Vector<float> gravity;
48 Vector<float> terminal;
51 std::vector<Tile> tiles;
53 std::list<Entity *> entities;