#ifndef SPACE_UNIVERSE_H_
#define SPACE_UNIVERSE_H_
-namespace space {
+#include "../entity/Entity.h"
+#include "../graphics/Vector.h"
+
+#include <list>
-class Sector;
+
+namespace space {
class Universe {
public:
- Universe(int w, int h, int sec_w, int sec_h, int numres);
+ Universe(Vector<int> size, Vector<int> secSize, Vector<int> areaSize);
~Universe();
-private:
- Universe(const Universe &);
- Universe &operator =(const Universe &);
+
+ Universe(const Universe &) = delete;
+ Universe &operator =(const Universe &) = delete;
+
+public:
+ const Vector<int> size;
+ const Vector<int> secSize;
+ const Vector<int> areaSize;
+
+public:
+ class Area;
+
+ class Sector {
+
+ public:
+ Sector(const Universe &univ, Vector<int> coords)
+ : univ(univ), coords(coords) { }
+
+ public:
+ Vector<int> SectorCoords() const { return coords; }
+ Vector<int> AreaCoords() const { return univ.areaSize * coords; }
+
+ Area AreaAt(Vector<int> ac) const { return univ.AreaAt(AreaCoords() + ac); }
+
+ private:
+ const Universe &univ;
+ Vector<int> coords;
+
+ };
+
+ class Area {
+
+ public:
+ Area(const Universe &univ, Vector<int> coords)
+ : univ(univ), coords(coords) { }
+
+ public:
+ Vector<int> SectorCoords() const { return coords / univ.areaSize; }
+ Vector<int> AreaCoords() const { return coords; }
+
+ Sector ParentSector() const { return univ.SectorAt(SectorCoords()); }
+
+ private:
+ const Universe &univ;
+ Vector<int> coords;
+
+ };
+
+public:
+ Sector SectorAt(Vector<int> coords) const { return Sector(*this, coords); }
+ Area AreaAt(Vector<int> coords) const { return Area(*this, coords); }
+
+public:
+ Entity *AddEntity(const Entity &);
+ const std::list<Entity> &Entities() const { return entities; }
+
+public:
+ void Update(float deltaT);
private:
- int w;
- int h;
- int numres;
- int total;
- Sector *sec_begin;
- Sector *sec_end;
+ std::list<Entity> entities;
};