Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/GraphicsManager.h @ 9420

Last change on this file since 9420 was 8858, checked in by landauf, 13 years ago

merged output branch back to trunk.

Changes:

  • you have to include util/Output.h instead of util/Debug.h
  • COUT(x) is now called orxout(level)
  • output levels are now defined by an enum instead of numbers. see util/Output.h for the definition
  • it's possible to use output contexts with orxout(level, context). see util/Output.h for some common contexts. you can define more contexts
  • you must use 'endl' at the end of an output message, '\n' does not flush the message

Output levels:

  • instead of COUT(0) use orxout()
  • instead of COUT(1) use orxout(user_error) or orxout(internal_error)
  • instead of COUT(2) use orxout(user_warning) or orxout(internal_warning)
  • instead of COUT(3) use orxout(user_status/user_info) or orxout(internal_status/internal_info)
  • instead of COUT(4) use orxout(verbose)
  • instead of COUT(5) use orxout(verbose_more)
  • instead of COUT(6) use orxout(verbose_ultra)

Guidelines:

  • user_* levels are for the user, visible in the console and the log-file
  • internal_* levels are for developers, visible in the log-file
  • verbose_* levels are for debugging, only visible if the context of the output is activated

Usage in C++:

  • orxout() << "message" << endl;
  • orxout(level) << "message" << endl;
  • orxout(level, context) << "message" << endl;

Usage in Lua:

  • orxout("message")
  • orxout(orxonox.level.levelname, "message")
  • orxout(orxonox.level.levelname, "context", "message")

Usage in Tcl (and in the in-game-console):

  • orxout levelname message
  • orxout_context levelname context message
  • shortcuts: log message, error message, warning message, status message, info message, debug message
  • Property svn:eol-style set to native
File size: 4.9 KB
RevLine 
[1035]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
[1505]3 *                    > www.orxonox.net <
[1035]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:
[1535]23 *      Reto Grieder
[1755]24 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
[1035]25 *   Co-authors:
[1755]26 *      Felix Schulthess
[1035]27 *
28 */
29
[612]30/**
[7401]31    @defgroup Graphics Graphics and GUI
32    @ingroup Core
33*/
34
35/**
[2801]36@file
[7401]37@ingroup Graphics
[2801]38@brief
39    Declaration of GraphicsManager Singleton.
[612]40 */
41
[2805]42#ifndef _GraphicsManager_H__
43#define _GraphicsManager_H__
[612]44
[3346]45#include "CorePrereqs.h"
[1039]46
[3196]47#include <cassert>
[715]48#include <string>
[2801]49#include <OgreLog.h>
[5695]50#include <boost/shared_ptr.hpp>
51
[8423]52#include "util/DestructionHelper.h"
[3366]53#include "util/Singleton.h"
[3346]54#include "OrxonoxClass.h"
[612]55
[8079]56// tolua_begin
[1625]57namespace orxonox
58{
[1214]59    /**
[2801]60    @brief
61        Graphics engine manager class
[1214]62    */
[8079]63    class _CoreExport GraphicsManager
64// tolua_end
65        : public Singleton<GraphicsManager>, public OrxonoxClass, public Ogre::LogListener
66    { // tolua_export
[3366]67        friend class Singleton<GraphicsManager>;
[1755]68    public:
[5695]69        GraphicsManager(bool bLoadRenderer = true);
[612]70
[8423]71        //! Leave empty and use cleanup() instead
72        ~GraphicsManager() {}
73        /// Destructor that also executes when object fails to construct
74        void destroy();
75
[1755]76        void setConfigValues();
[2801]77
[6417]78        void postUpdate(const Clock& time);
[2801]79
[5695]80        Ogre::Viewport* getViewport()         { return this->viewport_; }
81        Ogre::RenderWindow* getRenderWindow() { return this->renderWindow_; }
82        size_t getRenderWindowHandle();
[8079]83
84// tolua_begin
85        static GraphicsManager& getInstance() { return Singleton<GraphicsManager>::getInstance(); } // tolua_export
86
[5695]87        bool isFullScreen() const;
[8079]88        unsigned int getWindowWidth() const;
89        unsigned int getWindowHeight() const;
[2662]90
[8079]91        bool hasVSyncEnabled() const;
92        std::string getFSAAMode() const;
93// tolua_end
94
[5695]95        void upgradeToGraphics();
[5929]96        void loadDebugOverlay();
[5695]97        bool rendererLoaded() const { return renderWindow_ != NULL; }
98
[2850]99        void setCamera(Ogre::Camera* camera);
100
[1755]101    private:
[2801]102        GraphicsManager(GraphicsManager&); // don't mess with singletons
[1502]103
[2801]104        // OGRE initialisation
[5695]105        void loadOgreRoot();
[2801]106        void loadOgrePlugins();
107        void loadRenderer();
[2662]108
[2801]109        // event from Ogre::LogListener
110        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
[8706]111        bool maskDebug, const std::string& logName);
[612]112
[2801]113        // console commands
114        void printScreen();
[8079]115        std::string setScreenResolution(unsigned int width, unsigned int height, bool fullscreen);
116        std::string setFSAA(const std::string& mode);
117        std::string setVSync(bool vsync);
[2801]118
[8423]119        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
120        Ogre::LogManager*        ogreLogger_;
121        Ogre::Root*              ogreRoot_;                //!< Ogre's root
[2801]122        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
123        Ogre::Viewport*     viewport_;                 //!< default full size viewport
[8079]124        float               lastFrameStartTime_;       //!< Time stamp of the beginning of the last frame
125        float               lastFrameEndTime_;         //!< Time stamp of the end of the last frame
[2801]126
[5929]127        // XML files for the resources and the debug overlay
[5695]128        shared_ptr<XMLFile> resources_;                //!< XML with resource locations
129        shared_ptr<XMLFile> extResources_;             //!< XML with resource locations in the external path (only for dev runs)
[5929]130        shared_ptr<XMLFile> debugOverlay_;             //!< XML with various debug overlays
[5695]131
[1755]132        // config values
[6105]133        std::string         ogreConfigFile_;           //!< ogre config filename
[2801]134        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
[6105]135        std::string         ogreLogFile_;              //!< log filename for Ogre log messages
[1755]136
[8423]137        /// Helper object that executes the surrogate destructor destroy()
138        DestructionHelper<GraphicsManager> destructionHelper_;
139
[3366]140        static GraphicsManager* singletonPtr_s;        //!< Pointer to the Singleton
[8079]141// tolua_begin
[1214]142    };
[612]143}
[8079]144// tolua_end
[612]145
[2805]146#endif /* _GraphicsManager_H__ */
Note: See TracBrowser for help on using the repository browser.