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.y * size.x + pos.x; }
29 float MassAt(Vector<int> pos) const { return masses[Index(pos)]; }
30 void SetMass(Vector<int> pos, float m) { masses[Index(pos)] = m; }
32 Color ColorAt(Vector<int> pos) const { return colors[Index(pos)]; }
33 const Color *GetColors() const { return colors.data(); }
34 void SetColor(Vector<int> pos, Color c) {
35 colors[Index(pos)] = c;
38 bool ColorDirty() const { return colorDirty; }
39 void CleanColor() { colorDirty = false; }
41 const std::list<Entity> &Entities() const { return entities; }
42 Entity &AddEntity(const Entity &);
44 Vector<float> ForceAt(Vector<float>, float m) const;
45 bool WorldCollision(const Entity &, Vector<float> &) const;
46 Vector<float> NormalAt(Vector<float>) const;
47 bool IsSurface(Vector<int>) const;
53 std::vector<float> masses;
54 std::vector<Color> colors;
57 std::list<Entity> entities;