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);
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())
69 return GameState::MAIN_MENU;
73 this->willQuit =
true;
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.
void start(std::string levelName="")
Starts game, optionally loading a level.
ScoreFile * scores
All the current level's score.
bool willQuit()
If we'll quit the game right away.
bool willReturnToMenu()
If we'll return to the main menu.
Custom exception class to specify an error that occurred during a level loading.
void load()
Loads all high score entries based on a level name.
void save()
Saves all the current scores on the file.
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.