mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OpenGLApplication.h
Go to the documentation of this file.
1 
6 #include "OpenGLWindow.h"
7 class FrameCounter;
8 
26 public:
27  virtual ~OpenGLApplication( void );
28  // creation class, must be provided by the base class
29  static OpenGLApplication * create( const char * class_name );
30 
31 protected:
32  // the constructor is protected, thus only derived class can create instances
33  OpenGLApplication( const char * className );
34 
35  // functions that must be provided by the derived class
36  virtual bool initialize() = 0; // Perform All Initialization
37  virtual void deinitialize() = 0; // Perform All DeInitialization
38  virtual void update( DWORD milliseconds ) = 0; // Perform Motion Updates
39  virtual void draw() = 0; // Perform All Scene Drawing
40 
41  // methods provided by base class
42  OpenGLWindow * getWindow( void );
43  void fastMode(); // disables some OpenGL features
44  void fullMode(); // enables all OpenGL features
45  void terminate(); // Terminate The Application
46 
47  void toggleFullscreen(); // Toggle Fullscreen / Windowed Mode
48  void resizeDraw( bool enable ); // Enable Redraw During Window Resize
49 
50  void setFrameLimit( unsigned int framesPerSecond );// sets up a frame limit
51  unsigned int getFrameLimit( );
52 
53  // get the objects provided by this class
55 
56 private:
57  // Windows Main-Function and our mainfunction, Window procedure and our messagehandler
58  friend int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow );
59  int main( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow );
60  friend LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
61  LRESULT message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
62 
63  void drawTest();
64 
65  // constants
66  static const UINT WM_TOGGLEFULLSCREEN = ( WM_USER + 1 ); // application define message for toggling
67 
68  // variables
69  OpenGLWindow m_window;
70  const char * m_className;
71  bool m_isProgramLooping;
72  bool m_createFullScreen;
73  bool m_isVisible;
74  bool m_resizeDraw;
75 
76  int m_frameLimit; // number of frames that should be drawed per second
77  float frameTime;// time for a frame in milliseconds
78  bool useFrameLimit;// soll frame limit benutzt werden?
79  FrameCounter *fc; // frame counter, used for accurate timing
80 };