| [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> |
|---|
| [3370] | 36 | #include <boost/scoped_ptr.hpp> |
|---|
| [1747] | 37 | #include "util/OutputHandler.h" |
|---|
| [3370] | 38 | #include "util/ScopeGuard.h" |
|---|
| 39 | #include "util/Singleton.h" |
|---|
| [1505] | 40 | |
|---|
| 41 | namespace orxonox |
|---|
| 42 | { |
|---|
| [3280] | 43 | class CoreConfiguration; |
|---|
| 44 | |
|---|
| [3196] | 45 | /** |
|---|
| 46 | @brief |
|---|
| 47 | The Core class is a singleton used to configure the program basics. |
|---|
| [3370] | 48 | @remark |
|---|
| 49 | You should only create this singleton once because it destroys the identifiers! |
|---|
| [3196] | 50 | */ |
|---|
| [3370] | 51 | class _CoreExport Core : public Singleton<Core> |
|---|
| [1505] | 52 | { |
|---|
| [3370] | 53 | typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard; |
|---|
| 54 | friend class Singleton<Core>; |
|---|
| [5695] | 55 | friend class Game; |
|---|
| [3370] | 56 | |
|---|
| [1505] | 57 | public: |
|---|
| [3196] | 58 | /** |
|---|
| 59 | @brief |
|---|
| 60 | Determines the executable path, checks for build directory runs, creates |
|---|
| 61 | the output directories and sets up the other core library singletons. |
|---|
| 62 | @throws |
|---|
| 63 | GeneralException |
|---|
| 64 | */ |
|---|
| [3323] | 65 | Core(const std::string& cmdLine); |
|---|
| [2662] | 66 | ~Core(); |
|---|
| [2896] | 67 | |
|---|
| [1505] | 68 | void setConfigValues(); |
|---|
| 69 | |
|---|
| [2662] | 70 | static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All); |
|---|
| 71 | static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level); |
|---|
| [1505] | 72 | static const std::string& getLanguage(); |
|---|
| [2662] | 73 | static void resetLanguage(); |
|---|
| [1505] | 74 | |
|---|
| 75 | private: |
|---|
| [3196] | 76 | Core(const Core&); //!< Don't use (undefined symbol) |
|---|
| [2896] | 77 | |
|---|
| [5695] | 78 | void preUpdate(const Clock& time); |
|---|
| 79 | void postUpdate(const Clock& time); |
|---|
| 80 | |
|---|
| [2896] | 81 | void setThreadAffinity(int limitToCPU); |
|---|
| 82 | |
|---|
| [3370] | 83 | // Mind the order for the destruction! |
|---|
| [6038] | 84 | scoped_ptr<PathConfig> pathConfig_; |
|---|
| [5693] | 85 | scoped_ptr<DynLibManager> dynLibManager_; |
|---|
| [3370] | 86 | scoped_ptr<SignalHandler> signalHandler_; |
|---|
| 87 | SimpleScopeGuard identifierDestroyer_; |
|---|
| 88 | scoped_ptr<ConfigFileManager> configFileManager_; |
|---|
| 89 | scoped_ptr<Language> languageInstance_; |
|---|
| 90 | scoped_ptr<CoreConfiguration> configuration_; |
|---|
| [2710] | 91 | |
|---|
| [3370] | 92 | static Core* singletonPtr_s; |
|---|
| [1505] | 93 | }; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| [1531] | 96 | #endif /* _Core_H__ */ |
|---|