Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core7/src/libraries/core/Core.h @ 10464

Last change on this file since 10464 was 10464, checked in by landauf, 9 years ago

define ScopeID as integer constants instead of an enum. this allows to extend it and add new scopes outside of core.

  • Property svn:eol-style set to native
File size: 5.4 KB
RevLine 
[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"
[9667]49#include "config/Configurable.h"
[1505]50
51namespace orxonox
52{
[8729]53    //! Informs about changes in the Development Mode.
[9667]54    class DevModeListener : virtual public Listable
[8729]55    {
56    public:
57        DevModeListener();
58        virtual ~DevModeListener() {}
59        virtual void devModeChanged(bool value) = 0;
60    };
61
[3196]62    /**
63    @brief
64        The Core class is a singleton used to configure the program basics.
[3370]65    @remark
66        You should only create this singleton once because it destroys the identifiers!
[3196]67    */
[9667]68    class _CoreExport Core : public Singleton<Core>, public Configurable
[1505]69    {
[3370]70        friend class Singleton<Core>;
[5695]71        friend class Game;
[3370]72
[1505]73        public:
[3196]74            /**
75            @brief
76                Determines the executable path, checks for build directory runs, creates
77                the output directories and sets up the other core library singletons.
78            @throws
79                GeneralException
80            */
[3323]81            Core(const std::string& cmdLine);
[2896]82
[8423]83            /// Leave empty and use destroy() instead
84            ~Core() {}
85            /// Destructor that also executes when the object fails to construct
86            void destroy();
87
[1505]88            void setConfigValues();
89
[6417]90            //! Returns the configured language.
91            const std::string& getLanguage()
92                { return this->language_; }
93            void resetLanguage();
[1505]94
[7870]95            void updateLastLevelTimestamp();
96            inline long long getLastLevelTimestamp() const
97                { return this->lastLevelTimestamp_; }
98
99            void updateOgreConfigTimestamp();
100            inline long long getOgreConfigTimestamp() const
101                { return this->ogreConfigTimestamp_; }
102
[8366]103            //! Developers bit. If returns false, some options are not available as to not confuse the normal user.
[8079]104            inline bool inDevMode(void) const
105                { return this->bDevMode_; }
106
[1505]107        private:
[3196]108            Core(const Core&); //!< Don't use (undefined symbol)
[2896]109
[8729]110            void devModeChanged();
[6417]111            void languageChanged();
112            void initRandomNumberGenerator();
113
[5695]114            void preUpdate(const Clock& time);
115            void postUpdate(const Clock& time);
116
[5781]117            void loadGraphics();
118            void unloadGraphics();
119
[2896]120            void setThreadAffinity(int limitToCPU);
[8423]121
122            PathConfig*               pathConfig_;
123            DynLibManager*            dynLibManager_;
124            SignalHandler*            signalHandler_;
125            ConfigFileManager*        configFileManager_;
126            Language*                 languageInstance_;
[10392]127            Loader*                   loaderInstance_;
[8423]128            IOConsole*                ioConsole_;
129            TclBind*                  tclBind_;
130            TclThreadManager*         tclThreadManager_;
[10464]131            Scope<ScopeID::ROOT>*     rootScope_;
[5781]132            // graphical
[8423]133            GraphicsManager*          graphicsManager_;            //!< Interface to OGRE
134            InputManager*             inputManager_;               //!< Interface to OIS
135            GUIManager*               guiManager_;                 //!< Interface to GUI
[10464]136            Scope<ScopeID::GRAPHICS>* graphicsScope_;
[2710]137
[8423]138            bool                      bGraphicsLoaded_;
139            std::string               language_;                   //!< The language
140            bool                      bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
141            bool                      bStartIOConsole_;            //!< Set to false if you don't want to use the IOConsole
142            long long                 lastLevelTimestamp_;         ///< Timestamp when the last level was started
143            long long                 ogreConfigTimestamp_;        ///< Timestamp wehen the ogre config level was modified
144            bool                      bDevMode_;                   //!< Developers bit. If set to false, some options are not available as to not confuse the normal user.
[6417]145
[8423]146            /// Helper object that executes the surrogate destructor destroy()
147            DestructionHelper<Core>   destructionHelper_;
148
149            static Core*              singletonPtr_s;
[1505]150    };
151}
152
[1531]153#endif /* _Core_H__ */
Note: See TracBrowser for help on using the repository browser.