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>
|
|
|
|
#include <iostream>
|
2016-03-08 18:50:37 +00:00
|
|
|
#include "object.hpp"
|
2016-03-13 16:03:56 +00:00
|
|
|
#include "engine_state.hpp"
|
2016-03-08 16:46:33 +00:00
|
|
|
|
2016-03-08 17:07:34 +00:00
|
|
|
class Block : public Object {
|
2016-03-10 20:47:19 +00:00
|
|
|
protected:
|
2016-03-12 13:15:27 +00:00
|
|
|
sf::Texture texture;
|
2016-03-10 21:48:13 +00:00
|
|
|
sf::RectangleShape shape;
|
2016-03-10 20:47:19 +00:00
|
|
|
|
2016-03-08 16:46:33 +00:00
|
|
|
public:
|
2016-03-11 14:16:46 +00:00
|
|
|
static constexpr float GRID = 32;
|
|
|
|
|
2016-03-14 20:11:09 +00:00
|
|
|
Block(float x, float y);
|
2016-03-10 20:47:19 +00:00
|
|
|
|
2016-03-08 17:07:34 +00:00
|
|
|
/**
|
|
|
|
* Dessin du bloc dans la fenêtre donnée
|
|
|
|
*/
|
2016-03-08 16:46:33 +00:00
|
|
|
void draw(sf::RenderWindow& window);
|
2016-03-08 18:50:37 +00:00
|
|
|
|
2016-03-08 20:15:33 +00:00
|
|
|
/**
|
|
|
|
* Met à jour l'objet juste avant le dessin d'une frame
|
2016-03-08 22:27:44 +00:00
|
|
|
* Reçoit l'état actuel du moteur
|
2016-03-08 20:15:33 +00:00
|
|
|
*/
|
2016-03-13 16:03:56 +00:00
|
|
|
void update(EngineState& state);
|
2016-03-08 20:15:33 +00:00
|
|
|
|
2016-03-13 18:07:35 +00:00
|
|
|
/**
|
|
|
|
* Récupère la boîte englobante de l'objet
|
|
|
|
*/
|
|
|
|
std::unique_ptr<sf::FloatRect> getAABB();
|
|
|
|
|
2016-03-08 18:50:37 +00:00
|
|
|
/**
|
|
|
|
* Détermine la couche d'affichage de l'objet
|
|
|
|
*/
|
2016-03-14 20:11:09 +00:00
|
|
|
unsigned int getLayer();
|
2016-03-08 16:46:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|