Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5581 was 5366, checked in by bensch, 19 years ago

orxonox/trunk: more definitions of GLGui.
also a patch to the resource-manager

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
[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:
[5346]85    static bool             texturesEnabled;    //!< if textures should be enabled (globally)
[4784]86
87
[4619]88  private:
[5346]89    static GraphicsEngine*  singletonRef;       //!< Pointer to the only instance of this Class
90    bool                    isInit;             //!< if the GraphicsEngine is initialized.
[4619]91
[5346]92    // state.
93    SDL_Surface*            screen;             //!< the screen we draw to
94    int                     resolutionX;        //!< the X-resoultion of the screen
95    int                     resolutionY;        //!< the Y-resolution of the screen
96    int                     bitsPerPixel;       //!< the bits per pixels of the screen
97    Uint32                  fullscreenFlag;     //!< if we are in fullscreen mode
98    Uint32                  videoFlags;         //!< flags for video
99    SDL_Rect**              videoModes;         //!< list of resolutions
[4619]100
[5346]101    bool                    fogEnabled;         //!< If Fog should be enabled.
102    bool                    shadowsEnabled;     //!< If Shadows should be enabled.
103    bool                    particlesEnabled;   //!< If particles should be enabled.
104    int                     particlesValue;     //!< How many particles
105    int                     textureQuality;     //!< the quality of Textures
106    int                     filteringMethod;    //!< The filtering Method of textures.
107    int                     modelQuality;       //!< The quality of the Models loaded.
108    int                     antialiasingDepth;  //!< the Depth of the AntiAlias-Filter.
[4619]109
[5260]110    // HARDWARE-Settings:
[5346]111    char*                   hwRenderer;         //!< HW-renderer-string
112    char*                   hwVendor;           //!< HW-vendor-string
113    char*                   hwVersion;          //!< HW-version-string
114    SubString*              hwExtensions;       //!< All suported Extensions.
[4619]115
[5346]116    // FPS-related
117    bool                    bDisplayFPS;        //!< is true if the fps should be displayed
118    float                   currentFPS;         //!< the current frame rate: frames per seconds
119    float                   maxFPS;             //!< maximal frame rate we ever got since start of the game
120    float                   minFPS;             //!< minimal frame rate we ever got since start.
121
[4536]122#ifndef NO_TEXT
[5346]123  Text*          geTextCFPS;                    //!< Text for the current FPS
124  Text*          geTextMaxFPS;                  //!< Text for the max FPS
125  Text*          geTextMinFPS;                  //!< Text for the min FPS
[4536]126#endif /* NO_TEXT */
[1853]127};
128
[3610]129#endif /* _GRAPHICS_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.