diff --git a/include/game-engine.h b/include/game-engine.h index 3a564b5f7b147df08fcb561d20cc573c16396fe1..d5a7f7c33751f5c5c1d2c7c38afe69f52107c22b 100644 --- a/include/game-engine.h +++ b/include/game-engine.h @@ -12,6 +12,7 @@ #include "logger.h" #include "entity-manager.h" +#include "game-state.h" #include "scene.h" #include "asset.h" #include "save-manager.h" @@ -43,6 +44,7 @@ class GameEngine void handleInput(); private: SaveManager _saveManager; + GameState _state = Uninitialised; size_t _frame = 0; std::time_t _frametime = 0; EntityManager _entityManager; diff --git a/include/game-state.h b/include/game-state.h index fa1f9dfc7e168351c253691ede4c08ed4234adf9..0743d2e98992997eaa1fb425651f69c6f85ede47 100644 --- a/include/game-state.h +++ b/include/game-state.h @@ -1,3 +1,5 @@ +#ifndef __GAME_STATE__H__ +#define __GAME_STATE__H__ enum GameState { Uninitialised, @@ -6,3 +8,5 @@ enum GameState Active, Exit }; + +#endif // __GAME_STATE__H__ \ No newline at end of file diff --git a/src/game-engine.cpp b/src/game-engine.cpp index 678c13d2f13cdbf7b4fa97cb140a25db082ebf18..e63215f269bbced5536ab4428bde4c843cf1dc6f 100644 --- a/src/game-engine.cpp +++ b/src/game-engine.cpp @@ -15,6 +15,7 @@ void GameEngine::init() { this->isRunning = false; this->_currScene = ""; + this->_state = Initialise; // this->_saveManager.list(); } void GameEngine::changeScene( std::string label, Scene* scene ) diff --git a/src/main.cpp b/src/main.cpp index 7cc2341c2f6df87503561044a898c1a5a19f2168..307e37004651e1d2ef98d3b97c4e4f48ad1dd0ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,54 +3,15 @@ #ifndef __TEST_RUNNER__ int main( int argc, char* argv[] ) { - // const uint16_t SCREEN_HEIGHT = 600; - // const uint16_t SCREEN_WIDTH = 800; - - // GameState state = Uninitialised; - // Initialise Logger& logger = Logger::instance(); - // SaveManager saveManager; - // state = Initialise; - - // ConfigParser userSettings = ConfigParser::UserSettings(); - - // EntityManager entityManager; // Seed the random number generator srand(static_cast<unsigned int>(time(nullptr))); - // std::vector< Entity* > entities; - // Genrate a Random chunk - // WorldHex2D map( 5 ); - //Chunk* chunk = new Chunk( 0, 0, 0); - //std::cout << chunk.getString() << std::endl; - // Chunk* chunk = map.getMidChunk(); - // std::cout << chunk->getString() << std::endl; - // map.showChunk( 0, 0, 0 ); - // map.moveInto( -2, 1, 1 ); - // map.moveInto( -3, 2, 1 ); - // map.moveInto( 5, -2, -3 )->visualise(); - // map.visualise(); - - // Menu Loop - - // List Saves - // saveManager.list(); - GameEngine* game = new GameEngine(); game->run(); - // userSettings.set( "exit", "teset" ); - // std::cout << userSettings; - - // Clean-up - // while( entities.size() > 0 ) - // { - // Entity* entity = entities.back(); - // entities.pop_back(); - // delete entity; - // } delete game; // Return