Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/tutorialHS08/src/orxonox/GraphicsEngine.h @ 10241

Last change on this file since 10241 was 1755, checked in by rgrieder, 16 years ago

merged gui back to trunk.
update the media repository!

  • Property svn:eol-style set to native
File size: 3.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 *      Reto Grieder
24 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
25 *   Co-authors:
26 *      Felix Schulthess
27 *
28 */
29
30/**
31  @file
32  @brief Declaration of GraphicsEngine Singleton.
33  @author Benjamin Knecht <beni_at_orxonox.net>
34 */
35
36#ifndef _GraphicsEngine_H__
37#define _GraphicsEngine_H__
38
39#include "OrxonoxPrereqs.h"
40
41#include <string>
42
43#include <OgrePrerequisites.h>
44#include "core/OrxonoxClass.h"
45
46namespace orxonox
47{
48    /**
49    @brief Graphics engine manager class
50    */
51    class _OrxonoxExport GraphicsEngine : public OrxonoxClass
52    {
53        // HACK: temporary means
54        friend class GSGraphics;
55
56    public:
57        GraphicsEngine();
58        ~GraphicsEngine();
59
60        void setConfigValues();
61        void detailLevelParticleChanged();
62
63        void setLevelSceneManager(Ogre::SceneManager* sceneMgr) { this->levelSceneManager_ = sceneMgr; }
64        Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; }
65
66        Ogre::Viewport* getViewport() { return this->viewport_; }
67        Ogre::Root*     getOgreRoot() { return this->root_; }
68
69        // several window properties
70        int getWindowWidth() const;
71        int getWindowHeight() const;
72        float getWindowAspectRatio() const;
73        float getAverageFramesPerSecond() const   { return this->avgFramesPerSecond_; }
74        float getAverageTickTime() const          { return this->avgTickTime_; }
75        void setAverageTickTime(float tickTime)   { this->avgTickTime_ = tickTime; }
76        void setAverageFramesPerSecond(float fps) { this->avgFramesPerSecond_ = fps; }
77
78        inline unsigned int getDetailLevelParticle() const
79        { return this->detailLevelParticle_; }
80
81        static GraphicsEngine& getInstance();
82        static GraphicsEngine* getInstancePtr() { return singletonRef_s; }
83
84    private:
85        // don't mess with singletons
86        GraphicsEngine(GraphicsEngine&);
87
88        Ogre::Root*         root_;                  //!< Ogre's root
89        Ogre::RenderWindow* renderWindow_;          //!< the current render window
90        Ogre::SceneManager* levelSceneManager_;     //!< scene manager of the game
91        Ogre::Viewport*     viewport_;              //!< default full size viewport
92
93        // stats
94        float               avgTickTime_;           //!< time in ms to tick() one frame
95        float               avgFramesPerSecond_;    //!< number of frames processed in one second
96
97        // config values
98        unsigned int        detailLevelParticle_;   //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
99
100        static GraphicsEngine* singletonRef_s;      //!< Pointer to the Singleton
101    };
102}
103
104#endif /* _GraphicsEngine_H__ */
Note: See TracBrowser for help on using the repository browser.