[3245] | 1 | /*! |
---|
[3610] | 2 | \file graphics_engine.h |
---|
| 3 | |
---|
| 4 | \brief defines a Interface between orxonox and graphical input |
---|
[3329] | 5 | |
---|
[3610] | 6 | handles graphical SDL-initialisation, textures, resolutions, and so on |
---|
[3245] | 7 | */ |
---|
[1853] | 8 | |
---|
[3610] | 9 | #ifndef _GRAPHICS_ENGINE_H |
---|
| 10 | #define _GRAPHICS_ENGINE_H |
---|
[1853] | 11 | |
---|
[3611] | 12 | #include "glincl.h" |
---|
[3543] | 13 | #include "base_object.h" |
---|
[1853] | 14 | |
---|
[3543] | 15 | |
---|
[4283] | 16 | class Text; |
---|
[3543] | 17 | |
---|
[4283] | 18 | |
---|
[3610] | 19 | class GraphicsEngine : public BaseObject |
---|
| 20 | { |
---|
[1904] | 21 | public: |
---|
[3610] | 22 | static GraphicsEngine* getInstance(); |
---|
| 23 | virtual ~GraphicsEngine(); |
---|
[1853] | 24 | |
---|
[3611] | 25 | int initVideo(); |
---|
[3617] | 26 | int setGLattribs(void); |
---|
[3619] | 27 | int setResolution(int width, int height, int bpp); |
---|
[4178] | 28 | void setFullscreen(bool fullscreen = false); |
---|
[3790] | 29 | /** \returns the x resolution */ |
---|
| 30 | inline int getResolutionX(void) {return this->resolutionX;} |
---|
| 31 | /** \returns the y resolution */ |
---|
| 32 | inline int getResolutionY(void) {return this->resolutionY;} |
---|
| 33 | /** \returns the Bits Per Pixel */ |
---|
| 34 | inline int getbbp(void) {return this->bitsPerPixel;} |
---|
[3619] | 35 | int resolutionChanged(SDL_ResizeEvent* resizeInfo); |
---|
[3617] | 36 | void listModes(void); |
---|
[3611] | 37 | |
---|
| 38 | static bool texturesEnabled; |
---|
| 39 | |
---|
[3790] | 40 | static void enter2DMode(void); |
---|
| 41 | static void leave2DMode(void); |
---|
| 42 | |
---|
[3844] | 43 | static void storeMatrices(void); |
---|
| 44 | static GLdouble modMat[16]; |
---|
| 45 | static GLdouble projMat[16]; |
---|
| 46 | static GLint viewPort[4]; |
---|
[4283] | 47 | |
---|
| 48 | void tick(float dt); |
---|
| 49 | void displayFPS(bool display); |
---|
[3844] | 50 | |
---|
| 51 | |
---|
[3245] | 52 | private: |
---|
[3610] | 53 | GraphicsEngine(); |
---|
| 54 | static GraphicsEngine* singletonRef; |
---|
[3245] | 55 | |
---|
[3610] | 56 | |
---|
| 57 | SDL_Surface* screen; |
---|
[3611] | 58 | int resolutionX; |
---|
| 59 | int resolutionY; |
---|
| 60 | int bitsPerPixel; |
---|
| 61 | bool fullscreen; |
---|
| 62 | Uint32 videoFlags; |
---|
[4283] | 63 | |
---|
| 64 | bool bDisplayFPS; //!< is true if the fps should be displayed |
---|
| 65 | float currentFPS; //!< the current frame rate: frames per seconds |
---|
| 66 | float maxFPS; //!< maximal frame rate we ever got since start of the game |
---|
| 67 | float minFPS; //!< minimal frame rate we ever got since start |
---|
[3617] | 68 | |
---|
[4283] | 69 | Text* geTextCFPS; |
---|
| 70 | Text* geTextMaxFPS; |
---|
| 71 | Text* geTextMinFPS; |
---|
| 72 | |
---|
[3617] | 73 | SDL_Rect **videoModes; |
---|
[1853] | 74 | }; |
---|
| 75 | |
---|
[3610] | 76 | #endif /* _GRAPHICS_ENGINE_H */ |
---|