Fusion de collision_data et collision
This commit is contained in:
parent
aba30eefcd
commit
bc858a05d2
|
@ -1,7 +1,23 @@
|
|||
#ifndef __PTF_COLLISION_HPP__
|
||||
#define __PTF_COLLISION_HPP__
|
||||
|
||||
#include "collision_data.hpp"
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
class Object;
|
||||
|
||||
/**
|
||||
* Structure qui retient des informations
|
||||
* sur les collisions
|
||||
*/
|
||||
struct CollisionData {
|
||||
sf::Vector2f normal;
|
||||
float depth;
|
||||
|
||||
Object& objA;
|
||||
Object& objB;
|
||||
|
||||
CollisionData(Object& objA, Object& objB);
|
||||
};
|
||||
|
||||
/**
|
||||
* Détermine les informations sur la collision
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef __PTF_COLLISION_DATA_HPP__
|
||||
#define __PTF_COLLISION_DATA_HPP__
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
class Object;
|
||||
|
||||
/**
|
||||
* Structure qui retient des informations sur les
|
||||
* collisions
|
||||
*/
|
||||
struct CollisionData {
|
||||
sf::Vector2f normal;
|
||||
float depth;
|
||||
|
||||
Object& objA;
|
||||
Object& objB;
|
||||
|
||||
CollisionData(Object& objA, Object& objB) : objA(objA), objB(objB) {}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <memory>
|
||||
#include "collision_data.hpp"
|
||||
#include "collision.hpp"
|
||||
#include "manager.hpp"
|
||||
#include "resource_manager.hpp"
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "collision.hpp"
|
||||
#include "collision_data.hpp"
|
||||
#include "player.hpp"
|
||||
#include "block.hpp"
|
||||
#include "object.hpp"
|
||||
|
@ -195,6 +194,9 @@ std::map<
|
|||
{std::make_pair(Block::TYPE_ID, Block::TYPE_ID), blockToBlock}
|
||||
};
|
||||
|
||||
CollisionData::CollisionData(Object& objA, Object& objB) :
|
||||
objA(objA), objB(objB) {}
|
||||
|
||||
bool getCollisionData(CollisionData& data) {
|
||||
return collision_map[std::make_pair(
|
||||
data.objA.getTypeId(),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "object.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "collision.hpp"
|
||||
#include "collision_data.hpp"
|
||||
|
||||
Object::Object(float x, float y) :
|
||||
acceleration(0, 0), velocity(0, 0), position(x, y),
|
||||
|
|
Loading…
Reference in New Issue