[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 | |
---|
[1531] | 30 | #ifndef _Core_H__ |
---|
| 31 | #define _Core_H__ |
---|
[1505] | 32 | |
---|
| 33 | #include "CorePrereqs.h" |
---|
| 34 | |
---|
[2662] | 35 | #include <cassert> |
---|
[6417] | 36 | #include <string> |
---|
[3370] | 37 | #include <boost/scoped_ptr.hpp> |
---|
| 38 | #include "util/ScopeGuard.h" |
---|
| 39 | #include "util/Singleton.h" |
---|
[6442] | 40 | #include "OrxonoxClass.h" |
---|
[1505] | 41 | |
---|
| 42 | namespace orxonox |
---|
| 43 | { |
---|
[3196] | 44 | /** |
---|
| 45 | @brief |
---|
| 46 | The Core class is a singleton used to configure the program basics. |
---|
[3370] | 47 | @remark |
---|
| 48 | You should only create this singleton once because it destroys the identifiers! |
---|
[3196] | 49 | */ |
---|
[6417] | 50 | class _CoreExport Core : public Singleton<Core>, public OrxonoxClass |
---|
[1505] | 51 | { |
---|
[3370] | 52 | typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard; |
---|
| 53 | friend class Singleton<Core>; |
---|
[5695] | 54 | friend class Game; |
---|
[3370] | 55 | |
---|
[1505] | 56 | public: |
---|
[3196] | 57 | /** |
---|
| 58 | @brief |
---|
| 59 | Determines the executable path, checks for build directory runs, creates |
---|
| 60 | the output directories and sets up the other core library singletons. |
---|
| 61 | @throws |
---|
| 62 | GeneralException |
---|
| 63 | */ |
---|
[3323] | 64 | Core(const std::string& cmdLine); |
---|
[2662] | 65 | ~Core(); |
---|
[2896] | 66 | |
---|
[1505] | 67 | void setConfigValues(); |
---|
| 68 | |
---|
[6417] | 69 | //! Returns the configured language. |
---|
| 70 | const std::string& getLanguage() |
---|
| 71 | { return this->language_; } |
---|
| 72 | void resetLanguage(); |
---|
[1505] | 73 | |
---|
| 74 | private: |
---|
[3196] | 75 | Core(const Core&); //!< Don't use (undefined symbol) |
---|
[2896] | 76 | |
---|
[6417] | 77 | void languageChanged(); |
---|
| 78 | void initRandomNumberGenerator(); |
---|
| 79 | |
---|
[5695] | 80 | void preUpdate(const Clock& time); |
---|
| 81 | void postUpdate(const Clock& time); |
---|
| 82 | |
---|
[5781] | 83 | void loadGraphics(); |
---|
| 84 | void unloadGraphics(); |
---|
| 85 | |
---|
[2896] | 86 | void setThreadAffinity(int limitToCPU); |
---|
[6417] | 87 | // MANAGED SINGLETONS/OBJECTS |
---|
[3370] | 88 | // Mind the order for the destruction! |
---|
[5929] | 89 | scoped_ptr<PathConfig> pathConfig_; |
---|
[5693] | 90 | scoped_ptr<DynLibManager> dynLibManager_; |
---|
[3370] | 91 | scoped_ptr<SignalHandler> signalHandler_; |
---|
| 92 | SimpleScopeGuard identifierDestroyer_; |
---|
[5781] | 93 | SimpleScopeGuard consoleCommandDestroyer_; |
---|
[3370] | 94 | scoped_ptr<ConfigFileManager> configFileManager_; |
---|
| 95 | scoped_ptr<Language> languageInstance_; |
---|
[6105] | 96 | scoped_ptr<IOConsole> ioConsole_; |
---|
[5781] | 97 | scoped_ptr<TclBind> tclBind_; |
---|
| 98 | scoped_ptr<TclThreadManager> tclThreadManager_; |
---|
[6622] | 99 | scoped_ptr<Scope<ScopeID::Root> > rootScope_; |
---|
[5781] | 100 | // graphical |
---|
| 101 | scoped_ptr<GraphicsManager> graphicsManager_; //!< Interface to OGRE |
---|
| 102 | scoped_ptr<InputManager> inputManager_; //!< Interface to OIS |
---|
| 103 | scoped_ptr<GUIManager> guiManager_; //!< Interface to GUI |
---|
[5929] | 104 | scoped_ptr<Scope<ScopeID::Graphics> > graphicsScope_; |
---|
[2710] | 105 | |
---|
[5781] | 106 | bool bGraphicsLoaded_; |
---|
[6417] | 107 | int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler) |
---|
| 108 | std::string language_; //!< The language |
---|
| 109 | bool bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called |
---|
[6622] | 110 | bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole |
---|
[6417] | 111 | |
---|
| 112 | static Core* singletonPtr_s; |
---|
[1505] | 113 | }; |
---|
| 114 | } |
---|
| 115 | |
---|
[1531] | 116 | #endif /* _Core_H__ */ |
---|