2016-03-25 18:15:51 +00:00
|
|
|
#ifndef __PTF_COLLISION_HPP__
|
|
|
|
#define __PTF_COLLISION_HPP__
|
|
|
|
|
2016-03-30 21:17:01 +00:00
|
|
|
#include <SFML/Graphics.hpp>
|
2016-04-10 20:00:58 +00:00
|
|
|
#include <memory>
|
2016-03-30 21:17:01 +00:00
|
|
|
|
|
|
|
class Object;
|
|
|
|
|
|
|
|
/**
|
2016-04-09 13:32:42 +00:00
|
|
|
* Type de collision : entre deux rectangles ou
|
|
|
|
* entre deux cercles
|
|
|
|
*/
|
|
|
|
enum class CollisionType {AABB, CIRCLE};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure qui retient les informations
|
2016-03-30 21:17:01 +00:00
|
|
|
* sur les collisions
|
|
|
|
*/
|
|
|
|
struct CollisionData {
|
|
|
|
sf::Vector2f normal;
|
|
|
|
float depth;
|
|
|
|
|
2016-04-10 20:00:58 +00:00
|
|
|
std::shared_ptr<Object> obj_a;
|
|
|
|
std::shared_ptr<Object> obj_b;
|
2016-03-30 21:17:01 +00:00
|
|
|
|
2016-04-10 20:00:58 +00:00
|
|
|
CollisionData();
|
2016-03-30 21:17:01 +00:00
|
|
|
};
|
2016-03-25 18:15:51 +00:00
|
|
|
|
2016-03-30 21:14:31 +00:00
|
|
|
/**
|
|
|
|
* Détermine les informations sur la collision
|
2016-04-09 13:32:42 +00:00
|
|
|
* entre les deux objets donnés dans data et stocke
|
|
|
|
* ces informations dans data
|
2016-03-30 21:14:31 +00:00
|
|
|
*/
|
|
|
|
bool getCollisionData(CollisionData& data);
|
2016-03-25 18:15:51 +00:00
|
|
|
|
|
|
|
#endif
|