1 | /*! |
---|
2 | \file graphics_engine.h |
---|
3 | |
---|
4 | \brief defines a Interface between orxonox and graphical input |
---|
5 | |
---|
6 | handles graphical SDL-initialisation, textures, resolutions, and so on |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef _GRAPHICS_ENGINE_H |
---|
10 | #define _GRAPHICS_ENGINE_H |
---|
11 | |
---|
12 | #include "glincl.h" |
---|
13 | |
---|
14 | #include "base_object.h" |
---|
15 | |
---|
16 | // FORWARD DEFINITION \\ |
---|
17 | |
---|
18 | |
---|
19 | class GraphicsEngine : public BaseObject |
---|
20 | { |
---|
21 | public: |
---|
22 | static GraphicsEngine* getInstance(); |
---|
23 | virtual ~GraphicsEngine(); |
---|
24 | |
---|
25 | int initVideo(); |
---|
26 | int setGLattribs(void); |
---|
27 | int setResolution(int width, int height, int bpp); |
---|
28 | void setFullscreen(bool fullscreen = false); |
---|
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;} |
---|
35 | int resolutionChanged(SDL_ResizeEvent* resizeInfo); |
---|
36 | void listModes(void); |
---|
37 | |
---|
38 | static bool texturesEnabled; |
---|
39 | |
---|
40 | static void enter2DMode(void); |
---|
41 | static void leave2DMode(void); |
---|
42 | |
---|
43 | static void storeMatrices(void); |
---|
44 | static GLdouble modMat[16]; |
---|
45 | static GLdouble projMat[16]; |
---|
46 | static GLint viewPort[4]; |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | private: |
---|
51 | GraphicsEngine(); |
---|
52 | static GraphicsEngine* singletonRef; |
---|
53 | |
---|
54 | |
---|
55 | SDL_Surface* screen; |
---|
56 | int resolutionX; |
---|
57 | int resolutionY; |
---|
58 | int bitsPerPixel; |
---|
59 | bool fullscreen; |
---|
60 | Uint32 videoFlags; |
---|
61 | |
---|
62 | SDL_Rect **videoModes; |
---|
63 | }; |
---|
64 | |
---|
65 | #endif /* _GRAPHICS_ENGINE_H */ |
---|