]> git.localhorst.tv Git - gworm.git/blobdiff - src/world/World.h
added texture support
[gworm.git] / src / world / World.h
index 4cb5a2711096f4b7be4e3361aa8d8a292616a0b3..8a00f60541302a489d8e34565c916eecea3f7b5d 100644 (file)
@@ -1,9 +1,11 @@
 #ifndef GWORM_WORLD_H_
 #define GWORM_WORLD_H_
 
+#include "Entity.h"
 #include "../graphics/Color.h"
 #include "../graphics/Vector.h"
 
+#include <list>
 #include <vector>
 
 
@@ -20,6 +22,8 @@ public:
 public:
        void Update(float dt);
 
+       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; }
 
        float MassAt(Vector<int> pos) const { return masses[Index(pos)]; }
@@ -27,7 +31,13 @@ public:
        Color ColorAt(Vector<int> pos) const { return colors[Index(pos)]; }
        void SetColor(Vector<int> pos, Color c) { colors[Index(pos)] = c; }
 
+       const std::list<Entity> &Entities() const { return entities; }
+       Entity &AddEntity(const Entity &);
+
        Vector<float> ForceAt(Vector<float>, float m) const;
+       bool WorldCollision(const Entity &, Vector<float> &) const;
+       Vector<float> NormalAt(Vector<float>) const;
+       bool IsSurface(Vector<int>) const;
 
 private:
        Vector<int> size;
@@ -36,6 +46,8 @@ private:
        std::vector<float> masses;
        std::vector<Color> colors;
 
+       std::list<Entity> entities;
+
 };
 
 }