-
Notifications
You must be signed in to change notification settings - Fork 0
/
AABB.hpp
26 lines (20 loc) · 836 Bytes
/
AABB.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef AABB_HPP
#define AABB_HPP
#include <SFML/System/Vector2.hpp>
#include <SFML/Config.hpp>
enum CollisionFlags : sf::Uint8{noCollision=0, endGame=8, hurtWhenGreen=16, hurtWhenPurple=32, solidGreen=64, solidPurple=128};
enum CollisionOrientation{Top, Bottom, Right, Left};
class AABB
{
public:
AABB();
AABB(const AABB& other);
AABB(sf::Vector2f position, sf::Vector2f dimension, CollisionFlags flags=CollisionFlags::noCollision);
AABB(float x, float y, float width, float height, CollisionFlags flags=CollisionFlags::noCollision);
virtual ~AABB();
bool isColliding(const AABB& boundingBox)const;
CollisionOrientation getCollisionOrientation(const AABB& other)const;
sf::Vector2f m_position, m_dimension;
CollisionFlags m_flags;
};
#endif // AABB_HPP