bool InBounds(Vector<int> pos) const
{ return pos.x > 0 && pos.y > 0 && pos.x < size.x && pos.y < size.y; }
- int Index(Vector<int> pos) const { return pos.x * size.y + pos.y; }
+ int Index(Vector<int> pos) const { return pos.y * size.x + pos.x; }
float MassAt(Vector<int> pos) const { return masses[Index(pos)]; }
void SetMass(Vector<int> pos, float m) { masses[Index(pos)] = m; }
+
Color ColorAt(Vector<int> pos) const { return colors[Index(pos)]; }
- void SetColor(Vector<int> pos, Color c) { colors[Index(pos)] = c; }
+ const Color *GetColors() const { return colors.data(); }
+ void SetColor(Vector<int> pos, Color c) {
+ colors[Index(pos)] = c;
+ colorDirty = true;
+ }
+ bool ColorDirty() const { return colorDirty; }
+ void CleanColor() { colorDirty = false; }
const std::list<Entity> &Entities() const { return entities; }
Entity &AddEntity(const Entity &);
std::vector<float> masses;
std::vector<Color> colors;
+ bool colorDirty;
std::list<Entity> entities;