skizzle/include/block.hpp

41 lines
861 B
C++
Raw Normal View History

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"
#include "engine_state.hpp"
2016-03-08 16:46:33 +00:00
class Block : public Object {
protected:
2016-03-12 13:15:27 +00:00
sf::Texture texture;
sf::RectangleShape shape;
2016-03-08 16:46:33 +00:00
public:
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));
}
/**
* 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
*/
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