2016-03-28 15:23:47 +00:00
|
|
|
#ifndef __PTF_MANAGER_HPP__
|
|
|
|
#define __PTF_MANAGER_HPP__
|
|
|
|
|
|
|
|
#include "resource_manager.hpp"
|
|
|
|
#include "view.hpp"
|
2016-03-28 17:57:55 +00:00
|
|
|
#include <memory>
|
2016-03-28 15:23:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gestionnaire principal de toutes les vues et
|
|
|
|
* ressources du jeu
|
|
|
|
*/
|
|
|
|
class Manager {
|
|
|
|
private:
|
|
|
|
sf::RenderWindow window;
|
|
|
|
sf::Clock clock;
|
|
|
|
|
|
|
|
ResourceManager resource_manager;
|
|
|
|
std::array<bool, sf::Keyboard::KeyCount> keys;
|
|
|
|
|
2016-03-28 17:57:55 +00:00
|
|
|
std::shared_ptr<View> view;
|
2016-03-28 15:23:47 +00:00
|
|
|
|
2016-03-28 17:57:55 +00:00
|
|
|
public:
|
2016-03-28 15:23:47 +00:00
|
|
|
Manager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Démarre la boucle principale du jeu
|
|
|
|
*/
|
|
|
|
void start();
|
|
|
|
|
2016-03-28 17:57:55 +00:00
|
|
|
/**
|
|
|
|
* Charge la vue donnée dans le jeu
|
|
|
|
*/
|
|
|
|
void setView(std::shared_ptr<View> set_view);
|
|
|
|
|
2016-03-28 15:23:47 +00:00
|
|
|
/**
|
|
|
|
* Renvoie la fenêtre actuellement utilisée pour le dessin
|
|
|
|
*/
|
|
|
|
sf::RenderWindow& getWindow();
|
|
|
|
|
|
|
|
/**
|
2016-04-03 18:19:48 +00:00
|
|
|
* Renvoie le temps actuel du jeu
|
2016-03-28 15:23:47 +00:00
|
|
|
*/
|
2016-04-03 18:19:48 +00:00
|
|
|
sf::Time getCurrentTime() const;
|
2016-03-28 15:23:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renvoie le gestionnaire de ressources
|
|
|
|
*/
|
|
|
|
ResourceManager& getResourceManager();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renvoie un booléen attestant de l'appui sur la
|
|
|
|
* touche donnée ou non
|
|
|
|
*/
|
|
|
|
bool isKeyPressed(sf::Keyboard::Key key) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|