2016-04-09 13:53:12 +00:00
|
|
|
#ifndef __PTF_STATE_HPP__
|
|
|
|
#define __PTF_STATE_HPP__
|
2016-03-28 15:23:47 +00:00
|
|
|
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2016-04-09 02:36:30 +00:00
|
|
|
class ResourceManager;
|
2016-03-28 15:23:47 +00:00
|
|
|
class Manager;
|
|
|
|
class Object;
|
|
|
|
|
|
|
|
/**
|
2016-04-09 13:53:12 +00:00
|
|
|
* Classe abstraite pour les états de jeu
|
2016-03-28 15:23:47 +00:00
|
|
|
*/
|
2016-04-09 13:53:12 +00:00
|
|
|
class State {
|
2016-04-09 02:36:30 +00:00
|
|
|
private:
|
2016-03-30 12:01:41 +00:00
|
|
|
Manager& manager;
|
|
|
|
|
2016-03-28 15:23:47 +00:00
|
|
|
public:
|
2016-04-09 13:53:12 +00:00
|
|
|
State(Manager& manager);
|
|
|
|
virtual ~State();
|
2016-03-28 17:57:55 +00:00
|
|
|
|
2016-04-09 00:32:11 +00:00
|
|
|
/**
|
2016-04-09 21:57:23 +00:00
|
|
|
* Appelé par le manager lorsque l'état est utilisé
|
2016-04-09 00:32:11 +00:00
|
|
|
*/
|
|
|
|
virtual void begin() = 0;
|
|
|
|
|
2016-03-28 15:23:47 +00:00
|
|
|
/**
|
2016-04-09 21:57:23 +00:00
|
|
|
* Traite l'événement donné
|
|
|
|
*/
|
|
|
|
virtual void processEvent(const sf::Event& event) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Demande le dessin d'une frame
|
2016-03-28 15:23:47 +00:00
|
|
|
*/
|
2016-04-09 21:57:23 +00:00
|
|
|
virtual void frame() = 0;
|
2016-04-09 02:36:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Récupère le gestionnaire
|
|
|
|
*/
|
|
|
|
Manager& getManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Récupère le gestionnaire de ressources
|
|
|
|
*/
|
|
|
|
ResourceManager& getResourceManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Récupère la fenêtre
|
|
|
|
*/
|
|
|
|
sf::RenderWindow& getWindow();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Récupère si une touche est pressée
|
|
|
|
*/
|
|
|
|
bool isKeyPressed(sf::Keyboard::Key key) const;
|
2016-03-28 15:23:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|