1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * |
---|
4 | * |
---|
5 | * License notice: |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License |
---|
9 | * as published by the Free Software Foundation; either version 2 |
---|
10 | * of the License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
20 | * |
---|
21 | * Author: |
---|
22 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
23 | * Co-authors: |
---|
24 | * Reto Grieder |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | /** |
---|
29 | @file |
---|
30 | @brief Declaration of GraphicsEngine Singleton. |
---|
31 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef _GraphicsEngine_H__ |
---|
35 | #define _GraphicsEngine_H__ |
---|
36 | |
---|
37 | #include "OrxonoxPrereqs.h" |
---|
38 | |
---|
39 | #include <string> |
---|
40 | |
---|
41 | #include <OgrePrerequisites.h> |
---|
42 | #include <OgreLog.h> |
---|
43 | |
---|
44 | #include "core/OrxonoxClass.h" |
---|
45 | |
---|
46 | |
---|
47 | namespace orxonox { |
---|
48 | |
---|
49 | /** |
---|
50 | @brief Graphics engine manager class |
---|
51 | */ |
---|
52 | class _OrxonoxExport GraphicsEngine : public OrxonoxClass, public Ogre::LogListener |
---|
53 | { |
---|
54 | friend class ClassIdentifier<GraphicsEngine>; |
---|
55 | public: |
---|
56 | void setConfigPath(std::string path) { this->configPath_ = path; }; |
---|
57 | void setConfigValues(); |
---|
58 | void setup(); |
---|
59 | bool load(std::string path); |
---|
60 | void loadRessourceLocations(std::string path); |
---|
61 | Ogre::SceneManager* getSceneManager(); |
---|
62 | void initialise(); |
---|
63 | void destroy(); |
---|
64 | |
---|
65 | // several window properties |
---|
66 | Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; } |
---|
67 | size_t getWindowHandle(); |
---|
68 | int getWindowWidth() const; |
---|
69 | int getWindowHeight() const; |
---|
70 | |
---|
71 | static GraphicsEngine& getSingleton(); |
---|
72 | static GraphicsEngine* getSingletonPtr() { return &getSingleton(); } |
---|
73 | |
---|
74 | private: |
---|
75 | // don't mess with singletons |
---|
76 | GraphicsEngine(); |
---|
77 | ~GraphicsEngine(); |
---|
78 | GraphicsEngine(GraphicsEngine&) { } |
---|
79 | |
---|
80 | //! Method called by the LogListener from Ogre |
---|
81 | void messageLogged(const std::string&, Ogre::LogMessageLevel, |
---|
82 | bool, const std::string&); |
---|
83 | |
---|
84 | Ogre::Root* root_; //!< Ogre's root |
---|
85 | Ogre::SceneManager* scene_; //!< scene manager of the game |
---|
86 | Ogre::RenderWindow* renderWindow_;//!< the current render window |
---|
87 | //bool bOverwritePath_; //!< overwrites path |
---|
88 | std::string configPath_; //!< path to config file |
---|
89 | std::string dataPath_; //!< path to data file |
---|
90 | std::string ogreLogfile_; //!< log file name for Ogre log messages |
---|
91 | int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL |
---|
92 | int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL |
---|
93 | int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL |
---|
94 | |
---|
95 | }; |
---|
96 | |
---|
97 | } |
---|
98 | |
---|
99 | #endif /* _GraphicsEngine_H__ */ |
---|