Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.h @ 4066

Last change on this file since 4066 was 4066, checked in by patrick, 19 years ago

orxonox/branches/md2_loader: now it displays the fps, will do this better an look for a good font.

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