1 #include <States/GameStateGame.hpp> 2 #include <Engine/Flow/StateManager.hpp> 3 #include <Engine/Helpers/Utils.hpp> 4 #include <Engine/Graphics/Widgets/Dialog.hpp> 5 #include <Engine/Graphics/Ncurses.hpp> 6 #include <Config/Globals.hpp> 7 #include <Entities/BoardParser.hpp> 9 #include <Engine/Flow/StateManager.hpp> 10 #include <States/GameStateMainMenu.hpp> 12 GameStateGame::GameStateGame():
16 GameStateGame::~GameStateGame()
18 void GameStateGame::load()
21 this->game =
new Game();
22 this->game->
start(Globals::Game::current_level);
27 Dialog::show(
"Couldn't load the level! (Error: \"" + e.message +
"\")",
true);
28 this->willQuit =
true;
36 catch (std::runtime_error& e)
42 void GameStateGame::unload()
44 SAFE_DELETE(this->game);
46 void GameStateGame::update()
51 this->game->handleInput();
54 if (this->game->isOver())
61 Utils::Time::delay_ms(500);
65 if (Dialog::askBool(
"Retry?",
"Game Over",
true))
72 this->willQuit =
true;
77 void GameStateGame::draw()
Custom exception class to specify an error that occurred during a level loading.
void start(std::string levelName="")
Starts game, optionally loading a level.
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.
bool willQuit()
If we'll quit the game right away.
ScoreFile * scores
All the current level's score.