/*! \file graphics_engine.h \brief defines a Interface between orxonox and graphical input handles graphical SDL-initialisation, textures, resolutions, and so on */ #ifndef _GRAPHICS_ENGINE_H #define _GRAPHICS_ENGINE_H #include "glincl.h" #include "base_object.h" class Text; class GraphicsEngine : public BaseObject { public: static GraphicsEngine* getInstance(); virtual ~GraphicsEngine(); int initVideo(); int setGLattribs(void); int setResolution(int width, int height, int bpp); void setFullscreen(bool fullscreen = false); static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0); /** \returns the x resolution */ inline int getResolutionX(void) {return this->resolutionX;} /** \returns the y resolution */ inline int getResolutionY(void) {return this->resolutionY;} /** \returns the Bits Per Pixel */ inline int getbbp(void) {return this->bitsPerPixel;} int resolutionChanged(SDL_ResizeEvent* resizeInfo); void listModes(void); static bool texturesEnabled; static void enter2DMode(void); static void leave2DMode(void); static void storeMatrices(void); static GLdouble modMat[16]; static GLdouble projMat[16]; static GLint viewPort[4]; void tick(float dt); void displayFPS(bool display); private: GraphicsEngine(); static GraphicsEngine* singletonRef; SDL_Surface* screen; int resolutionX; int resolutionY; int bitsPerPixel; bool fullscreen; Uint32 videoFlags; bool bDisplayFPS; //!< is true if the fps should be displayed float currentFPS; //!< the current frame rate: frames per seconds float maxFPS; //!< maximal frame rate we ever got since start of the game float minFPS; //!< minimal frame rate we ever got since start Text* geTextCFPS; Text* geTextMaxFPS; Text* geTextMinFPS; SDL_Rect **videoModes; }; #endif /* _GRAPHICS_ENGINE_H */