Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation2/src/libraries/core/Core.h @ 6177

Last change on this file since 6177 was 6121, checked in by rgrieder, 15 years ago

Removed CoreConfiguration and GameConfiguration workaround. I have found an easy solution that doesn't need this.
Config values for these classes can again be found under "Game" and "Core".

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