2016-04-06 09:38:13 +00:00
|
|
|
#ifndef __PTF_MENU_HPP__
|
|
|
|
#define __PTF_MENU_HPP__
|
|
|
|
|
|
|
|
#include "manager.hpp"
|
2016-04-09 13:53:12 +00:00
|
|
|
#include "state.hpp"
|
2016-04-09 00:32:11 +00:00
|
|
|
#include <functional>
|
2016-04-06 09:38:13 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* La classe Menu charge le menu du jeu
|
|
|
|
* et permet de choisir entre jouer, lire les règles
|
|
|
|
* et quitter.
|
|
|
|
*/
|
2016-04-09 13:53:12 +00:00
|
|
|
class Menu : public State {
|
2016-04-09 00:32:11 +00:00
|
|
|
private:
|
2016-04-09 21:33:05 +00:00
|
|
|
sf::Sprite background;
|
|
|
|
|
2016-04-09 00:32:11 +00:00
|
|
|
std::vector<sf::String> choices;
|
2016-04-09 01:11:14 +00:00
|
|
|
std::vector<sf::Text> labels;
|
2016-04-09 00:32:11 +00:00
|
|
|
std::vector<std::function<void(void)>> actions;
|
|
|
|
unsigned int selection;
|
|
|
|
|
|
|
|
protected:
|
2016-04-09 01:11:14 +00:00
|
|
|
/**
|
|
|
|
* Affiche les règles du jeu
|
|
|
|
*/
|
|
|
|
void loadRules();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Démarre l'éditeur
|
|
|
|
*/
|
|
|
|
void launchEditor();
|
|
|
|
|
|
|
|
/**
|
2016-04-11 01:50:08 +00:00
|
|
|
* Démarre le jeu avec le niveau dont le chemin
|
|
|
|
* complet absolu est donné en paramètre
|
2016-04-09 01:11:14 +00:00
|
|
|
*/
|
2016-04-11 01:50:08 +00:00
|
|
|
void launchGame(std::string path);
|
2016-04-09 01:11:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Quitte le jeu et le menu
|
|
|
|
*/
|
|
|
|
void quit();
|
|
|
|
|
2016-04-06 09:38:13 +00:00
|
|
|
public:
|
|
|
|
Menu(Manager& manager);
|
|
|
|
virtual ~Menu();
|
|
|
|
|
|
|
|
/**
|
2016-04-09 21:57:23 +00:00
|
|
|
* Traite l'événement donné
|
|
|
|
*/
|
|
|
|
virtual void processEvent(const sf::Event& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Demande le dessin d'une frame
|
2016-04-07 22:19:01 +00:00
|
|
|
*/
|
2016-04-09 21:57:23 +00:00
|
|
|
virtual void frame();
|
2016-04-06 09:38:13 +00:00
|
|
|
|
|
|
|
/**
|
2016-04-09 00:32:11 +00:00
|
|
|
* Affiche le menu principal
|
2016-04-06 09:38:13 +00:00
|
|
|
*/
|
2016-04-09 00:32:11 +00:00
|
|
|
void loadMainMenu();
|
2016-04-06 09:38:13 +00:00
|
|
|
|
2016-04-09 00:32:11 +00:00
|
|
|
/**
|
|
|
|
* Affiche le menu de choix des niveaux
|
|
|
|
*/
|
|
|
|
void loadLevelMenu();
|
2016-04-06 09:38:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|