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
OpenGLWindow.h
Go to the documentation of this file.
1 
7 #include "Structures.h"
8 #include <Windows.h>
9 
21 class OpenGLWindow {
22 public:
23  OpenGLWindow( void );
24  ~OpenGLWindow( void );
25 
27  bool create( const char * windowTitle, bool fullscreen, const char * className, HINSTANCE hInstance, LPVOID lpParam );
28 
29  bool isFullscreen( void );
30 
31  float getAspect( void );
32  unsigned int getHeight( void );
33  unsigned int getWidth( void );
34  unsigned int getLeft( void );
35  unsigned int getTop( void );
37 
38  // key input
39  void keyDown( unsigned char i ) { keys[i] = true; }
40  bool keyPressed(unsigned char i ) { return keys[i]; }
41  void keyUp( unsigned char i) { keys[i] = false; }
42  // mouse input
43  void setMousePosition( int x, int y );
45  void setMouseClick( bool click );
46  bool getMouseClick( void );
47  void showMousePointer( bool mouseVisible );
48 
49  void kill( void );
50  void reshape( void );
51 
52  void setBits( int bits ) { this->m_bpp = bits; }
53  void setLeft( unsigned int left );
54  void setTop( unsigned int top );
55  void setHeight( unsigned int height );
56  void setWidth( unsigned int width );
57 
58  void swap( void ) { SwapBuffers( m_hDC ); }
59 
60  HDC getDC( void ) { return m_hDC; }
61 
62  // Class conversion operator for window handle. with this, OpenGLWindow can be used as HWND
63  operator HWND() { return m_hWnd; }
64 
65 private:
66  bool keys[256]; // array for keyboard routinges
67  Position m_mousePos; // holds information about mouse position
68  bool m_mouseClick; // checks if a (left) mouse click has occured
69  bool active; // window active flag set to TRUE by default
70  HWND m_hWnd;
71  HDC m_hDC;
72  HGLRC m_hRC;
73  bool m_fullscreen; // fullscreen flag set to fullscreen mode by default
74  int m_bpp; // bits per pixel (color)
75  int m_width;
76  int m_height;
77  int m_screenWidth;
78  int m_screenHeight;
79  int m_left; // window x position
80  int m_top; // window y position
81  FrustumInformation m_frustum; // contains information about the frustum
82  bool m_mouseVisible;
83 };