00001 // ///////////////////////////////////////////////////////////////////////////// 00002 // 00003 // Name: GameManager.h 00004 // Author: Michael Bartsch (ZCCdark203) 00005 // 00006 // Desc : Declaration of the GameManager class. 00007 // 00008 // License: Copyright (C) 2009 Michael Bartsch and Contributors 00009 // 00010 // This program is free software: you can redistribute it 00011 // and/or modify it under the terms of the zlib/libpng License. 00012 // See main.cpp for conditions of distribution and use. 00013 // 00014 // ///////////////////////////////////////////////////////////////////////////// 00015 00016 #ifndef __GAMEMANAGER_H__ 00017 #define __GAMEMANAGER_H__ 00018 00019 // Include files 00020 #include "../dependencies.h" 00021 #include "ReferenceCounted.h" 00022 00023 #include "AssetManager.h" 00024 #include "DataStore.h" 00025 #include "EntityManager.h" 00026 #include "EventManager.h" 00027 00028 #ifdef __COMPILE_WITH_SFML_AUDIO__ 00029 #include "../sound/SoundManager.h" 00030 #endif // __COMPILE_WITH_SFML_AUDIO__ 00031 00032 #ifdef __COMPILE_WITH_ANGELSCRIPT__ 00033 #include "../scripting/ScriptManager.h" 00034 #endif // __COMPILE_WITH_ANGELSCRIPT__ 00035 00036 #include "../components/components.h" 00037 00038 #include "GameState.h" 00039 00040 // Forward declarations 00041 class GameState; 00042 class ScriptManager; 00043 00044 00045 // GameManager class 00049 class GameManager : public ReferenceCounted 00050 { 00051 public: 00052 00053 // Initialisation, deinitialisation and control... 00055 GameManager(); 00057 ~GameManager(); 00058 00060 static GameManager* Instance(); 00062 static GameManager& Reference(); 00063 00065 void init(); 00067 void update(); 00069 void clear(); 00070 00071 // Reference counting 00074 void grab(); 00077 void drop(); 00078 00079 // Public methods 00082 void changeState(GameState *state); 00085 void pushState(GameState *state); 00087 void popState(); 00088 00091 IrrlichtDevice* getDevice(); 00094 IVideoDriver* getDriver(); 00097 ISceneManager* getSceneManager(); 00100 IGUIEnvironment* getGUIEnvironment(); 00101 00103 AssetManager* getAssetManager(); 00105 DataStore* getDataStore(); 00107 EntityManager* getEntityManager(); 00109 EventManager* getEventManager(); 00110 00111 #ifdef __COMPILE_WITH_ANGELSCRIPT__ 00113 ScriptManager* getScriptManager(); 00114 #endif // __COMPILE_WITH_ANGELSCRIPT__ 00115 00116 #ifdef __COMPILE_WITH_SFML_AUDIO__ 00118 SoundManager* getSoundManager(); 00119 #endif // __COMPILE_WITH_SFML_AUDIO__ 00120 00122 bool getIsRunning() const; 00123 00125 void setIsRunning(bool value); 00126 00127 00128 private: 00129 00130 // GameManager singleton 00131 static GameManager *pInstance; 00132 00133 // Normal members 00134 vector<GameState*> mGameStates; 00135 00136 IrrlichtDevice *pDevice; 00137 IVideoDriver *pDriver; 00138 ISceneManager *pSceneManager; 00139 IGUIEnvironment *pGUIEnvironment; 00140 00141 AssetManager *pAssetManager; 00142 DataStore *pDataStore; 00143 EntityManager *pEntityManager; 00144 EventManager *pEventManager; 00145 00146 #ifdef __COMPILE_WITH_ANGELSCRIPT__ 00147 ScriptManager *pScriptManager; 00148 #endif // __COMPILE_WITH_ANGELSCRIPT__ 00149 00150 #ifdef __COMPILE_WITH_SFML_AUDIO__ 00151 SoundManager *pSoundManager; 00152 #endif // __COMPILE_WITH_SFML_AUDIO__ 00153 00154 u32 mLastTime; 00155 }; 00156 00157 #endif