5 #include "../graphics/Color.h"
6 #include "../graphics/Vector.h"
17 World(Vector<int> size);
20 Vector<int> Size() const { return size; }
23 void Update(float dt);
25 bool InBounds(Vector<int> pos) const
26 { return pos.x > 0 && pos.y > 0 && pos.x < size.x && pos.y < size.y; }
27 int Index(Vector<int> pos) const { return pos.x * size.y + pos.y; }
29 float MassAt(Vector<int> pos) const { return masses[Index(pos)]; }
30 void SetMass(Vector<int> pos, float m) { masses[Index(pos)] = m; }
31 Color ColorAt(Vector<int> pos) const { return colors[Index(pos)]; }
32 void SetColor(Vector<int> pos, Color c) { colors[Index(pos)] = c; }
34 const std::list<Entity> &Entities() const { return entities; }
35 Entity &AddEntity(const Entity &);
37 Vector<float> ForceAt(Vector<float>, float m) const;
38 bool WorldCollision(const Entity &, Vector<float> &) const;
39 Vector<float> NormalAt(Vector<float>) const;
40 bool IsSurface(Vector<int>) const;
46 std::vector<float> masses;
47 std::vector<Color> colors;
49 std::list<Entity> entities;