Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/Core.h @ 8729

Last change on this file since 8729 was 8729, checked in by rgrieder, 13 years ago

Merged unity_build branch back to trunk.

Features:

  • Implemented fully automatic build units to speed up compilation if requested
  • Added DOUT macro for quick debug output
  • Activated text colouring in the POSIX IOConsole
  • DeclareToluaInterface is not necessary anymore

Improvements:

  • Output levels now change appropriately when switch back and forth from dev mode
  • Log level for the file output is now also correct during startup
  • Removed some header file dependencies in core and tools to speed up compilation

no more file for command line options

  • Improved util::tribool by adapting some concepts from boost::tribool

Regressions:

  • It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
  • Property svn:eol-style set to native
File size: 5.5 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/**
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
41#ifndef _Core_H__
42#define _Core_H__
43
44#include "CorePrereqs.h"
45
46#include <string>
47#include "util/DestructionHelper.h"
48#include "util/Singleton.h"
49#include "OrxonoxClass.h"
50
51namespace orxonox
52{
53    //! Informs about changes in the Development Mode.
54    class DevModeListener : virtual public OrxonoxClass
55    {
56    public:
57        DevModeListener();
58        virtual ~DevModeListener() {}
59        virtual void devModeChanged(bool value) = 0;
60    };
61
62    /**
63    @brief
64        The Core class is a singleton used to configure the program basics.
65    @remark
66        You should only create this singleton once because it destroys the identifiers!
67    */
68    class _CoreExport Core : public Singleton<Core>, public OrxonoxClass
69    {
70        friend class Singleton<Core>;
71        friend class Game;
72
73        public:
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            */
81            Core(const std::string& cmdLine);
82
83            /// Leave empty and use destroy() instead
84            ~Core() {}
85            /// Destructor that also executes when the object fails to construct
86            void destroy();
87
88            void setConfigValues();
89
90            //! Returns the configured language.
91            const std::string& getLanguage()
92                { return this->language_; }
93            void resetLanguage();
94
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
103            //! Developers bit. If returns false, some options are not available as to not confuse the normal user.
104            inline bool inDevMode(void) const
105                { return this->bDevMode_; }
106
107        private:
108            Core(const Core&); //!< Don't use (undefined symbol)
109
110            void devModeChanged();
111            void languageChanged();
112            void initRandomNumberGenerator();
113
114            void preUpdate(const Clock& time);
115            void postUpdate(const Clock& time);
116
117            void loadGraphics();
118            void unloadGraphics();
119
120            void setThreadAffinity(int limitToCPU);
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_;
131            // graphical
132            GraphicsManager*          graphicsManager_;            //!< Interface to OGRE
133            InputManager*             inputManager_;               //!< Interface to OIS
134            GUIManager*               guiManager_;                 //!< Interface to GUI
135            Scope<ScopeID::Graphics>* graphicsScope_;
136
137            bool                      bGraphicsLoaded_;
138            int                       debugLevelLogFile_;          //!< The debug level for the log file (belongs to OutputHandler)
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.
145
146            /// Helper object that executes the surrogate destructor destroy()
147            DestructionHelper<Core>   destructionHelper_;
148
149            static Core*              singletonPtr_s;
150    };
151}
152
153#endif /* _Core_H__ */
Note: See TracBrowser for help on using the repository browser.