mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-09 12:22:34 +01:00
48 lines
958 B
C++
48 lines
958 B
C++
#include "menustate.hpp"
|
|
#include "game.hpp"
|
|
#include "ingamestate.hpp"
|
|
|
|
#include "RWGame.hpp"
|
|
|
|
MenuState::MenuState(RWGame* game)
|
|
: State(game)
|
|
{
|
|
Menu *m = new Menu(game->getFont());
|
|
m->offset = glm::vec2(50.f, 100.f);
|
|
m->addEntry(Menu::lambda("Start", [=] { StateManager::get().enter(new IngameState(game)); }));
|
|
m->addEntry(Menu::lambda("Test", [=] { StateManager::get().enter(new IngameState(game, true)); }));
|
|
m->addEntry(Menu::lambda("Options", [] { std::cout << "Options" << std::endl; }));
|
|
m->addEntry(Menu::lambda("Exit", [=] { getWindow().close(); }));
|
|
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);
|
|
}
|