[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Fabian 'x3n' Landau |
---|
[2896] | 24 | * Reto Grieder |
---|
[1505] | 25 | * Co-authors: |
---|
[2896] | 26 | * ... |
---|
[1505] | 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
[7401] | 30 | /** |
---|
| 31 | @defgroup CoreGame Core and Game |
---|
| 32 | @ingroup Management |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | @file |
---|
| 37 | @ingroup Management CoreGame |
---|
| 38 | @brief Declaration of the Core singleton which is used to configure the program basics. |
---|
| 39 | */ |
---|
| 40 | |
---|
[1531] | 41 | #ifndef _Core_H__ |
---|
| 42 | #define _Core_H__ |
---|
[1505] | 43 | |
---|
| 44 | #include "CorePrereqs.h" |
---|
| 45 | |
---|
[6417] | 46 | #include <string> |
---|
[8423] | 47 | #include "util/DestructionHelper.h" |
---|
[3370] | 48 | #include "util/Singleton.h" |
---|
[10479] | 49 | #include "CoreConfig.h" |
---|
[1505] | 50 | |
---|
| 51 | namespace orxonox |
---|
| 52 | { |
---|
[3196] | 53 | /** |
---|
| 54 | @brief |
---|
| 55 | The Core class is a singleton used to configure the program basics. |
---|
[3370] | 56 | @remark |
---|
| 57 | You should only create this singleton once because it destroys the identifiers! |
---|
[3196] | 58 | */ |
---|
[10479] | 59 | class _CoreExport Core : public Singleton<Core> |
---|
[1505] | 60 | { |
---|
[3370] | 61 | friend class Singleton<Core>; |
---|
| 62 | |
---|
[1505] | 63 | public: |
---|
[3196] | 64 | /** |
---|
| 65 | @brief |
---|
| 66 | Determines the executable path, checks for build directory runs, creates |
---|
| 67 | the output directories and sets up the other core library singletons. |
---|
| 68 | @throws |
---|
| 69 | GeneralException |
---|
| 70 | */ |
---|
[3323] | 71 | Core(const std::string& cmdLine); |
---|
[2896] | 72 | |
---|
[8423] | 73 | /// Leave empty and use destroy() instead |
---|
| 74 | ~Core() {} |
---|
| 75 | /// Destructor that also executes when the object fails to construct |
---|
| 76 | void destroy(); |
---|
| 77 | |
---|
[10518] | 78 | void preUpdate(const Clock& time); |
---|
| 79 | void postUpdate(const Clock& time); |
---|
| 80 | |
---|
| 81 | void loadGraphics(); |
---|
[10524] | 82 | void unloadGraphics(bool loadGraphicsManagerWithoutRenderer = true); |
---|
[10518] | 83 | |
---|
| 84 | void loadModules(); |
---|
| 85 | void unloadModules(); |
---|
| 86 | void loadModule(ModuleInstance* module); |
---|
| 87 | void unloadModule(ModuleInstance* module); |
---|
| 88 | |
---|
[10479] | 89 | inline CoreConfig* getConfig() const |
---|
| 90 | { return this->config_; } |
---|
[1505] | 91 | |
---|
| 92 | private: |
---|
[3196] | 93 | Core(const Core&); //!< Don't use (undefined symbol) |
---|
[2896] | 94 | |
---|
| 95 | void setThreadAffinity(int limitToCPU); |
---|
[8423] | 96 | |
---|
[10532] | 97 | ApplicationPaths* applicationPaths_; |
---|
| 98 | ConfigurablePaths* configurablePaths_; |
---|
| 99 | DynLibManager* dynLibManager_; |
---|
| 100 | SignalHandler* signalHandler_; |
---|
| 101 | ConfigFileManager* configFileManager_; |
---|
| 102 | Language* languageInstance_; |
---|
| 103 | Loader* loaderInstance_; |
---|
| 104 | IOConsole* ioConsole_; |
---|
| 105 | TclBind* tclBind_; |
---|
| 106 | TclThreadManager* tclThreadManager_; |
---|
| 107 | Scope<ScopeID::ROOT>* rootScope_; |
---|
[5781] | 108 | // graphical |
---|
[10532] | 109 | GraphicsManager* graphicsManager_; //!< Interface to OGRE |
---|
| 110 | InputManager* inputManager_; //!< Interface to OIS |
---|
| 111 | GUIManager* guiManager_; //!< Interface to GUI |
---|
| 112 | Scope<ScopeID::GRAPHICS>* graphicsScope_; |
---|
| 113 | bool bGraphicsLoaded_; |
---|
[6417] | 114 | |
---|
[10532] | 115 | CoreStaticInitializationHandler* staticInitHandler_; |
---|
[10552] | 116 | PluginManager* pluginManager_; |
---|
[10532] | 117 | ModuleInstance* rootModule_; |
---|
| 118 | std::list<ModuleInstance*> modules_; |
---|
| 119 | |
---|
[10479] | 120 | /// Helper object that stores the config values |
---|
[10532] | 121 | CoreConfig* config_; |
---|
[10479] | 122 | |
---|
[8423] | 123 | /// Helper object that executes the surrogate destructor destroy() |
---|
[10532] | 124 | DestructionHelper<Core> destructionHelper_; |
---|
[8423] | 125 | |
---|
[10532] | 126 | static Core* singletonPtr_s; |
---|
[1505] | 127 | }; |
---|
| 128 | } |
---|
| 129 | |
---|
[1531] | 130 | #endif /* _Core_H__ */ |
---|