Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: ability to change background color

File size: 1.9 KB
Line 
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#include "base_object.h"
14
15
16class Text;
17
18
19class 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  static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
30
31  /** \returns the x resolution */
32  inline int getResolutionX(void) {return this->resolutionX;}
33  /** \returns the y resolution */
34  inline int getResolutionY(void) {return this->resolutionY;}
35  /** \returns the Bits Per Pixel */
36  inline int getbbp(void) {return this->bitsPerPixel;}
37  int resolutionChanged(SDL_ResizeEvent* resizeInfo);
38  void listModes(void);
39
40  static bool texturesEnabled;
41
42  static void enter2DMode(void);
43  static void leave2DMode(void);
44
45  static void storeMatrices(void);
46  static GLdouble modMat[16];
47  static GLdouble projMat[16];
48  static GLint viewPort[4];
49 
50  void tick(float dt);
51  void displayFPS(bool display);
52
53
54 private:
55  GraphicsEngine();
56  static GraphicsEngine* singletonRef;
57
58
59  SDL_Surface* screen;
60  int resolutionX;
61  int resolutionY;
62  int bitsPerPixel;
63  bool fullscreen;
64  Uint32 videoFlags;
65 
66  bool bDisplayFPS;  //!< is true if the fps should be displayed
67  float currentFPS;  //!< the current frame rate: frames per seconds
68  float maxFPS;      //!< maximal frame rate we ever got since start of the game
69  float minFPS;      //!< minimal frame rate we ever got since start
70
71  Text* geTextCFPS;
72  Text* geTextMaxFPS;
73  Text* geTextMinFPS;
74
75  SDL_Rect **videoModes;
76};
77
78#endif /* _GRAPHICS_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.