Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/libraries/core/Core.h @ 7158

Last change on this file since 7158 was 6746, checked in by rgrieder, 15 years ago

Merged gamestates2 branch back to trunk.
This brings in some heavy changes in the GUI framework.
It should also fix problems with triggered asserts in the InputManager.

Note: PickupInventory does not seem to work —> Segfault when showing because before, the owner in GUIOverlay::setGUIName is already NULL.
I haven't tested it before, so I can't tell whether it's my changes.

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