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> 9 GameStateGame::GameStateGame():
13 GameStateGame::~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;
void draw()
Shows everything onscreen;.
Custom exception class to specify an error that occurred during a level loading.
void start(std::string levelName="")
Starts game, optionally loading a level.
GameState::StateCode update()
Updates all possible things on the game.
void save()
Saves all the current scores on the file.
bool willReturnToMenu()
If we'll return to the main menu.
void load()
Loads all high score entries based on a level name.
Custom exception class to specify an error that occurred during a level loading.
void delay_ms(int delay)
Sleeps for #delay miliseconds.
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.
StateCode
All possible transitions between states.
void load(int stack=0)
Constructs everything necessary for the game.
bool willQuit()
If we'll quit the game right away.
int unload()
Destroys anything builded during the game.
ScoreFile * scores
All the current level's score.