Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4451 was 4381, checked in by bensch, 20 years ago

orxonox/trunk: made include more local. stdincl.h not in base_object.h anymore

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