Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/powerups/src/lib/graphics/graphics_engine.h @ 5955

Last change on this file since 5955 was 5955, checked in by bensch, 18 years ago

branches/powerups: merged the trunk to branches/powerup
merged with commandsvn merge ../trunk/ powerups/ -r5848:HEAD
conflicts resolved in favor of the trunk

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