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>
12GameStateGame::GameStateGame():
16GameStateGame::~GameStateGame()
18void 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)
42void GameStateGame::unload()
44 SAFE_DELETE(this->game);
46void 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;
77void 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.
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.