2016-03-08 22:28:50 +00:00
|
|
|
#ifndef __PTF_BLOCK_HPP__
|
|
|
|
#define __PTF_BLOCK_HPP__
|
2016-03-08 16:46:33 +00:00
|
|
|
|
|
|
|
#include <SFML/Graphics.hpp>
|
2016-03-08 18:50:37 +00:00
|
|
|
#include "object.hpp"
|
2016-03-08 16:46:33 +00:00
|
|
|
|
2016-03-08 17:07:34 +00:00
|
|
|
class Block : public Object {
|
2016-03-15 16:08:21 +00:00
|
|
|
private:
|
2016-04-07 09:22:20 +00:00
|
|
|
mutable sf::Sprite select_sprite;
|
2016-03-10 20:47:19 +00:00
|
|
|
|
2016-04-09 03:51:55 +00:00
|
|
|
protected:
|
|
|
|
mutable sf::Sprite sprite;
|
|
|
|
|
2016-03-08 16:46:33 +00:00
|
|
|
public:
|
2016-03-31 17:45:57 +00:00
|
|
|
/**
|
2016-04-09 01:53:17 +00:00
|
|
|
* Identifiant unique du type "bloc"
|
2016-03-31 17:45:57 +00:00
|
|
|
*/
|
|
|
|
static const unsigned int TYPE_ID;
|
|
|
|
|
2016-04-02 13:18:29 +00:00
|
|
|
Block();
|
2016-03-28 18:02:23 +00:00
|
|
|
virtual ~Block();
|
2016-03-10 20:47:19 +00:00
|
|
|
|
2016-04-06 11:54:03 +00:00
|
|
|
/**
|
2016-04-09 01:53:17 +00:00
|
|
|
* Clone ce bloc en un bloc avec les mêmes propriétés
|
2016-04-06 11:54:03 +00:00
|
|
|
*/
|
|
|
|
virtual ObjectPtr clone() const;
|
|
|
|
|
2016-04-01 20:44:10 +00:00
|
|
|
/**
|
2016-04-09 01:53:17 +00:00
|
|
|
* Récupère la boîte englobante du bloc
|
2016-04-01 20:44:10 +00:00
|
|
|
*/
|
2016-04-10 03:10:27 +00:00
|
|
|
virtual sf::FloatRect getAABB() const;
|
2016-04-01 20:44:10 +00:00
|
|
|
|
2016-04-09 13:32:42 +00:00
|
|
|
/**
|
|
|
|
* Récupère le rayon du bloc
|
|
|
|
*/
|
|
|
|
virtual float getRadius() const;
|
|
|
|
|
2016-04-09 03:51:55 +00:00
|
|
|
/**
|
|
|
|
* Opérations de préparation de la texture du bloc
|
|
|
|
*/
|
|
|
|
virtual void beforeDraw(Level& level);
|
|
|
|
|
2016-03-08 17:07:34 +00:00
|
|
|
/**
|
|
|
|
* Dessin du bloc dans la fenêtre donnée
|
|
|
|
*/
|
2016-04-09 02:36:30 +00:00
|
|
|
virtual void draw(Level& level);
|
2016-03-08 20:15:33 +00:00
|
|
|
|
2016-03-13 18:07:35 +00:00
|
|
|
/**
|
2016-04-09 01:53:17 +00:00
|
|
|
* Appelé lorsque le bloc est activé par un objet
|
2016-03-13 18:07:35 +00:00
|
|
|
*/
|
2016-04-09 03:43:40 +00:00
|
|
|
virtual void activated(Level& level, Object& object);
|
2016-03-15 21:00:03 +00:00
|
|
|
|
|
|
|
/**
|
2016-04-09 01:53:17 +00:00
|
|
|
* Récupère l'identifiant de type des blocs
|
2016-03-15 21:00:03 +00:00
|
|
|
*/
|
2016-03-28 15:23:47 +00:00
|
|
|
virtual unsigned int getTypeId() const;
|
2016-04-09 01:53:17 +00:00
|
|
|
|
2016-04-09 13:32:42 +00:00
|
|
|
/**
|
|
|
|
* Récupère le type de collision des blocs
|
|
|
|
*/
|
|
|
|
virtual CollisionType getCollisionType() const;
|
|
|
|
|
2016-04-09 01:53:17 +00:00
|
|
|
/**
|
|
|
|
* Chargement du bloc depuis le fichier donné
|
|
|
|
*/
|
|
|
|
static ObjectPtr load(std::ifstream& file);
|
2016-03-08 16:46:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|