Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/graphics_engine.h @ 6483

Last change on this file since 6483 was 6142, checked in by bensch, 19 years ago

orxonox/trunk: merge the ObjectManager to the trunk
merged with command:
svn merge -r6082:HEAD objectmanager/ ../trunk/

conflicts resolution was easy this time :)
but specially merged the world to network_world

File size: 4.8 KB
RevLine 
[4619]1/*!
[5039]2 * @file graphics_engine.h
[4619]3
[4836]4  *  defines a Interface between orxonox and graphical input
[3329]5
[3610]6    handles graphical SDL-initialisation, textures, resolutions, and so on
[4817]7 */
[1853]8
[3610]9#ifndef _GRAPHICS_ENGINE_H
10#define _GRAPHICS_ENGINE_H
[1853]11
[4817]12#include "event_listener.h"
[1853]13
[4381]14#include "sdlincl.h"
15#include "glincl.h"
[3543]16
[6142]17#include <list>
18
[4381]19// Forward Declaration
[4245]20class Text;
[4770]21class IniParser;
[5260]22class SubString;
[6142]23class WorldEntity;
[3543]24
[4458]25//! class to handle graphics
26/**
27   handles graphical SDL-initialisation, textures, resolutions, and so on
[4619]28 */
[4817]29class GraphicsEngine : public EventListener
[3610]30{
[4619]31  public:
32    virtual ~GraphicsEngine();
[4836]33    /** @returns a Pointer to the only object of this Class */
[5216]34    inline static GraphicsEngine* getInstance() { if (!GraphicsEngine::singletonRef) GraphicsEngine::singletonRef = new GraphicsEngine();  return GraphicsEngine::singletonRef; };
[1853]35
[4784]36    int init();
37    int initFromIniFile(IniParser* iniParser);
[4374]38
[4619]39    void setWindowName(const char* windowName, const char* icon);
[4831]40
[4619]41    int setResolution(int width, int height, int bpp);
42    void setFullscreen(bool fullscreen = false);
43    static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
[3611]44
[4831]45
[4836]46    /** @returns the x resolution */
[4746]47    inline int getResolutionX() const { return this->resolutionX; };
[4836]48    /** @returns the y resolution */
[4746]49    inline int getResolutionY() const { return this->resolutionY; };
[4836]50    /** @returns the Bits Per Pixel */
[4746]51    inline int getbbp() const { return this->bitsPerPixel; };
[3611]52
[4782]53    int resolutionChanged(const SDL_ResizeEvent& resizeInfo);
[3790]54
[4833]55    static void showMouse(bool show);
56    static bool isMouseVisible();
57    static void stealWMEvents(bool steal);
58    static bool isStealingEvents();
[4831]59
[4746]60    static void enter2DMode();
61    static void leave2DMode();
[3844]62
[4746]63    static void storeMatrices();
[4619]64    static GLdouble modMat[16];
65    static GLdouble projMat[16];
66    static GLint viewPort[4];
[3844]67
[5084]68    void update(float dt);
[4619]69    void tick(float dt);
[4849]70    void draw() const;
[6142]71    void draw(const std::list<WorldEntity*>& drawList) const;
[4619]72    void displayFPS(bool display);
[3245]73
[4746]74    void listModes();
[5261]75    bool hwSupportsEXT(const char* extension);
[3617]76
[5366]77    /** @brief swaps the GL_BUFFERS */
[4834]78    inline static void swapBuffers() { SDL_GL_SwapBuffers(); };
[4681]79
[4817]80    void process(const Event  &event);
[4619]81
82  private:
83    GraphicsEngine();
[4784]84    int initVideo(unsigned int resX, unsigned int resY, unsigned int bbp);
[4831]85    int setGLattribs();
[5260]86    void grabHardwareSettings();
[4619]87
[4784]88  public:
89
[4619]90  private:
[5346]91    static GraphicsEngine*  singletonRef;       //!< Pointer to the only instance of this Class
92    bool                    isInit;             //!< if the GraphicsEngine is initialized.
[4619]93
[5346]94    // state.
95    SDL_Surface*            screen;             //!< the screen we draw to
96    int                     resolutionX;        //!< the X-resoultion of the screen
97    int                     resolutionY;        //!< the Y-resolution of the screen
98    int                     bitsPerPixel;       //!< the bits per pixels of the screen
99    Uint32                  fullscreenFlag;     //!< if we are in fullscreen mode
100    Uint32                  videoFlags;         //!< flags for video
101    SDL_Rect**              videoModes;         //!< list of resolutions
[4619]102
[5346]103    bool                    fogEnabled;         //!< If Fog should be enabled.
104    bool                    shadowsEnabled;     //!< If Shadows should be enabled.
105    bool                    particlesEnabled;   //!< If particles should be enabled.
106    int                     particlesValue;     //!< How many particles
107    int                     textureQuality;     //!< the quality of Textures
108    int                     filteringMethod;    //!< The filtering Method of textures.
109    int                     modelQuality;       //!< The quality of the Models loaded.
110    int                     antialiasingDepth;  //!< the Depth of the AntiAlias-Filter.
[4619]111
[5260]112    // HARDWARE-Settings:
[5346]113    char*                   hwRenderer;         //!< HW-renderer-string
114    char*                   hwVendor;           //!< HW-vendor-string
115    char*                   hwVersion;          //!< HW-version-string
116    SubString*              hwExtensions;       //!< All suported Extensions.
[4619]117
[5346]118    // FPS-related
119    bool                    bDisplayFPS;        //!< is true if the fps should be displayed
120    float                   currentFPS;         //!< the current frame rate: frames per seconds
121    float                   maxFPS;             //!< maximal frame rate we ever got since start of the game
122    float                   minFPS;             //!< minimal frame rate we ever got since start.
123
[4536]124#ifndef NO_TEXT
[5346]125  Text*          geTextCFPS;                    //!< Text for the current FPS
126  Text*          geTextMaxFPS;                  //!< Text for the max FPS
127  Text*          geTextMinFPS;                  //!< Text for the min FPS
[4536]128#endif /* NO_TEXT */
[1853]129};
130
[3610]131#endif /* _GRAPHICS_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.