]> git.localhorst.tv Git - gworm.git/blobdiff - src/world/World.h
some lousy world collision, friction, and drag
[gworm.git] / src / world / World.h
index f15d43b8ae818c0a9a6cacf51baa230b48866763..8a00f60541302a489d8e34565c916eecea3f7b5d 100644 (file)
@@ -22,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)]; }
@@ -33,6 +35,9 @@ public:
        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;