2014-05-26 06:34:49 +02:00
|
|
|
#include "menustate.hpp"
|
|
|
|
#include "game.hpp"
|
|
|
|
#include "ingamestate.hpp"
|
|
|
|
|
2014-09-16 20:22:43 +02:00
|
|
|
#include "RWGame.hpp"
|
|
|
|
|
|
|
|
MenuState::MenuState(RWGame* game)
|
|
|
|
: State(game)
|
2014-05-26 06:34:49 +02:00
|
|
|
{
|
2015-02-07 23:55:06 +01:00
|
|
|
Menu *m = new Menu(2);
|
|
|
|
m->offset = glm::vec2(200.f, 200.f);
|
2014-09-16 20:22:43 +02:00
|
|
|
m->addEntry(Menu::lambda("Start", [=] { StateManager::get().enter(new IngameState(game)); }));
|
|
|
|
m->addEntry(Menu::lambda("Test", [=] { StateManager::get().enter(new IngameState(game, true)); }));
|
2014-05-26 06:34:49 +02:00
|
|
|
m->addEntry(Menu::lambda("Options", [] { std::cout << "Options" << std::endl; }));
|
2014-09-16 20:22:43 +02:00
|
|
|
m->addEntry(Menu::lambda("Exit", [=] { getWindow().close(); }));
|
2014-05-26 06:34:49 +02:00
|
|
|
this->enterMenu(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuState::enter()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuState::exit()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuState::tick(float dt)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuState::handleEvent(const sf::Event &e)
|
|
|
|
{
|
|
|
|
switch(e.type) {
|
|
|
|
case sf::Event::KeyPressed:
|
|
|
|
switch(e.key.code) {
|
|
|
|
case sf::Keyboard::Escape:
|
|
|
|
StateManager::get().exit();
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
State::handleEvent(e);
|
|
|
|
}
|