Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core6/src/libraries/core/Core.h @ 9640

Last change on this file since 9640 was 9589, checked in by landauf, 11 years ago

interfaces which are part of the framework and only rely on the object list for calling all instances may inherit from Listable

  • 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"
[9589]49#include "config/Configurable.h"
[1505]50
51namespace orxonox
52{
[8729]53    //! Informs about changes in the Development Mode.
[9589]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    */
[9578]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_;
127            IOConsole*                ioConsole_;
128            TclBind*                  tclBind_;
129            TclThreadManager*         tclThreadManager_;
130            Scope<ScopeID::Root>*     rootScope_;
[5781]131            // graphical
[8423]132            GraphicsManager*          graphicsManager_;            //!< Interface to OGRE
133            InputManager*             inputManager_;               //!< Interface to OIS
134            GUIManager*               guiManager_;                 //!< Interface to GUI
135            Scope<ScopeID::Graphics>* graphicsScope_;
[2710]136
[8423]137            bool                      bGraphicsLoaded_;
138            std::string               language_;                   //!< The language
139            bool                      bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
140            bool                      bStartIOConsole_;            //!< Set to false if you don't want to use the IOConsole
141            long long                 lastLevelTimestamp_;         ///< Timestamp when the last level was started
142            long long                 ogreConfigTimestamp_;        ///< Timestamp wehen the ogre config level was modified
143            bool                      bDevMode_;                   //!< Developers bit. If set to false, some options are not available as to not confuse the normal user.
[6417]144
[8423]145            /// Helper object that executes the surrogate destructor destroy()
146            DestructionHelper<Core>   destructionHelper_;
147
148            static Core*              singletonPtr_s;
[1505]149    };
150}
151
[1531]152#endif /* _Core_H__ */
Note: See TracBrowser for help on using the repository browser.