1#include <Flow/GameStateGame.hpp>
2#include <Flow/StateManager.hpp>
3#include <Misc/Utils.hpp>
4#include <Interface/Dialog.hpp>
5#include <Interface/Ncurses.hpp>
6#include <Config/Globals.hpp>
7#include <Game/BoardParser.hpp>
9GameStateGame::GameStateGame():
13GameStateGame::~GameStateGame()
20 this->game =
new Game();
21 this->game->start(Globals::Game::current_level);
22 this->game->scores->load();
26 Dialog::show(
"Couldn't load the level! (Error: \"" + e.message +
"\")",
true);
27 this->willQuit =
true;
35 catch (std::runtime_error& e)
43 SAFE_DELETE(this->game);
50 return GameState::QUIT;
52 this->game->handleInput();
55 if (this->game->isOver())
61 this->game->scores->save();
69 return GameState::MAIN_MENU;
72 if (this->game->willQuit())
73 this->willQuit =
true;
75 if (this->game->willReturnToMenu())
76 return GameState::MAIN_MENU;
78 return GameState::CONTINUE;
Custom exception class to specify an error that occurred during a level loading.
int unload()
Destroys anything builded during the game.
GameState::StateCode update()
Updates all possible things on the game.
void draw()
Shows everything onscreen;.
void load(int stack=0)
Constructs everything necessary for the game.
StateCode
All possible transitions between states.
Custom exception class to specify an error that occurred during a level loading.
bool askBool(std::string question, std::string title="", bool default_value=false)
Spawns a Dialog box asking for a yes-or-no question.
void show(std::string message, bool pressAnyKey=false)
Shows a message on the screen.
void delay_ms(int delay)
Sleeps for delay miliseconds.