Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/resource/src/core/Core.h @ 3361

Last change on this file since 3361 was 3349, checked in by rgrieder, 15 years ago

Moved InputManager, GUIManager and GraphicsManager handling from GSGraphics to Core.

  • Property svn:eol-style set to native
File size: 4.8 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@file
32@brief
33    Declaration of the Core class.
34@details
35    The Core class is a singleton, only used to configure some variables
36    in the core through the config-file.
37*/
38
39#ifndef _Core_H__
40#define _Core_H__
41
42#include "CorePrereqs.h"
43
44#include <cassert>
45#include "util/OutputHandler.h"
46
47namespace orxonox
48{
49    class CoreConfiguration;
50
51    /**
52    @brief
53        The Core class is a singleton used to configure the program basics.
54    @details
55        The class provides information about the media, config and log path.
56        It determines those by the use of platform specific functions.
57    */
58    class _CoreExport Core
59    {
60        public:
61            /**
62            @brief
63                Determines the executable path, checks for build directory runs, creates
64                the output directories and sets up the other core library singletons.
65            @throws
66                GeneralException
67            */
68            Core(const std::string& cmdLine);
69            ~Core();
70
71            void setConfigValues();
72
73            bool preUpdate(const Clock& time) throw();
74            bool postUpdate(const Clock& time) throw();
75
76            void loadGraphics();
77            void unloadGraphics();
78
79            static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
80
81            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
82            static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
83            static const std::string& getLanguage();
84            static void  resetLanguage();
85
86            static void tsetMediaPath(const std::string& path);
87            //! Returns the path to the config files as boost::filesystem::path
88            static const boost::filesystem::path& getMediaPath();
89            //! Returns the path to the config files as boost::filesystem::path
90            static const boost::filesystem::path& getConfigPath();
91            //! Returns the path to the log files as boost::filesystem::path
92            static const boost::filesystem::path& getLogPath();
93            //! Returns the path to the root folder as boost::filesystem::path
94            static const boost::filesystem::path& getRootPath();
95            //! Returns the path to the data files as std::string
96            static std::string getMediaPathString();
97            //! Returns the path to the config files as std::string
98            static std::string getConfigPathString();
99            //! Returns the path to the log files as std::string
100            static std::string getLogPathString();
101            //! Returns the path to the root folder as std::string
102            static std::string getRootPathString();
103
104            static bool isDevelopmentRun() { return getInstance().bDevRun_; }
105
106        private:
107            Core(const Core&); //!< Don't use (undefined symbol)
108
109            void checkDevBuild();
110            void setExecutablePath();
111            void createDirectories();
112            void setThreadAffinity(int limitToCPU);
113
114            // Singletons
115            ConfigFileManager*    configFileManager_;
116            Language*             languageInstance_;
117            LuaBind*              luaBind_;
118            Shell*                shell_;
119            SignalHandler*        signalHandler_;
120            TclBind*              tclBind_;
121            TclThreadManager*     tclThreadManager_;
122            // graphical
123            InputManager*         inputManager_;        //!< Interface to OIS
124            GUIManager*           guiManager_;          //!< Interface to GUI
125            GraphicsManager*      graphicsManager_;     //!< Interface to OGRE
126
127            bool                  bDevRun_;             //!< True for runs in the build directory (not installed)
128            bool                  bGraphicsLoaded_;
129            CoreConfiguration*    configuration_;
130
131            static Core* singletonRef_s;
132    };
133}
134
135#endif /* _Core_H__ */
Note: See TracBrowser for help on using the repository browser.