diff options
Diffstat (limited to 'include/YAGE/Physics/collider.hpp')
-rw-r--r-- | include/YAGE/Physics/collider.hpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/YAGE/Physics/collider.hpp b/include/YAGE/Physics/collider.hpp index ff074f14..234ff57f 100644 --- a/include/YAGE/Physics/collider.hpp +++ b/include/YAGE/Physics/collider.hpp @@ -1,13 +1,35 @@ #ifndef YAGE_COLLIDER_HPP #define YAGE_COLLIDER_HPP -// The Collider class helps collision detection +#include <glm/glm.hpp> +namespace yage +{ + +// The Collider class helps collision detection by providing a general shape +// for different shapes to have their own collision algorithms. class Collider { +protected: + // position of the object + glm::vec2 position_; + + // size of the object + glm::vec2 size_; + public: - virtual ~Collider(); + Collider(const glm::vec2 &position, const glm::vec2 &size) : position_(position), size_(size) {} + + // virtual deconstructor for classes that inherits + virtual ~Collider() {} + + // function that checks if two colliders are colliding + virtual bool collides(const Collider &collider) const=0; + + // function that returns if a point is inside the shape + virtual bool inside(const glm::vec2 &point) const=0; }; +} // yage #endif |