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;
|
|
|
|
|
|
|
|
Block(float x, float y) : Object(x, y), shape(sf::Vector2f(Block::GRID, Block::GRID)) {
|
2016-03-11 15:15:11 +00:00
|
|
|
shape.setOrigin(sf::Vector2f(Block::GRID / 2, Block::GRID / 2));
|
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-08 18:50:37 +00:00
|
|
|
/**
|
|
|
|
* Détermine la couche d'affichage de l'objet
|
|
|
|
*/
|
|
|
|
unsigned int getLayer() {
|
|
|
|
return 0;
|
|
|
|
}
|
2016-03-08 16:46:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|