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
Public Member Functions | List of all members
OpenGLWindow Class Reference

A basic window with additional members. More...

#include <OpenGLWindow.h>

Public Member Functions

 OpenGLWindow (void)
 Default constructor. Initializes the necessary member variables.
 
 ~OpenGLWindow (void)
 
bool changeScreenResolution ()
 change the screen resolution
 
bool create (const char *windowTitle, bool fullscreen, const char *className, HINSTANCE hInstance, LPVOID lpParam)
 
bool isFullscreen (void)
 Returns true if the window is in fullscreen mode and false else.
 
float getAspect (void)
 Gets the aspect ratio of the window.
 
unsigned int getHeight (void)
 Gets the height of the window.
 
unsigned int getWidth (void)
 Gets the width of the window.
 
unsigned int getLeft (void)
 Gets the coordinate of the left corners. 0 if full screen.
 
unsigned int getTop (void)
 Gets the coordinate of the top corners. 0 if full screen.
 
FrustumInformation getFrustum (void)
 Returns the current frustum data which is updated on resize.
 
void keyDown (unsigned char i)
 
bool keyPressed (unsigned char i)
 
void keyUp (unsigned char i)
 
void setMousePosition (int x, int y)
 Sets a new mouse position.
 
Position getMousePosition ()
 Gets the mouse position.
 
void setMouseClick (bool click)
 Sets, if a mouse click occured.
 
bool getMouseClick (void)
 Gets, if a mouse click occured.
 
void showMousePointer (bool mouseVisible)
 Shows and hides the mouse pointer, but hiding takes place only in full screen mode.
 
void kill (void)
 Closes the window, release all ressources.
 
void reshape (void)
 Update sthe member variables and the aspect ratio.
 
void setBits (int bits)
 
void setLeft (unsigned int left)
 
void setTop (unsigned int top)
 
void setHeight (unsigned int height)
 
void setWidth (unsigned int width)
 
void swap (void)
 
HDC getDC (void)
 
 operator HWND ()
 

Detailed Description

A basic window with additional members.

Supports the use of OpenGL by providing easy access to aspect ratios, viewport and automatically setting a perspective view.

Author
Jan-Philipp Kappmeier
Date
27/09/2012

Definition at line 21 of file OpenGLWindow.h.

Constructor & Destructor Documentation

OpenGLWindow::OpenGLWindow ( void  )

Default constructor. Initializes the necessary member variables.

All keys are set to not pressed, color depth is 24 bits, full screen is deactivated.

Definition at line 17 of file OpenGLWindow.cpp.

OpenGLWindow::~OpenGLWindow ( void  )

Destructor.

Definition at line 51 of file OpenGLWindow.cpp.

Member Function Documentation

bool OpenGLWindow::changeScreenResolution ( )

change the screen resolution

Definition at line 58 of file OpenGLWindow.cpp.

bool OpenGLWindow::create ( const char *  windowTitle,
bool  fullscreen,
const char *  className,
HINSTANCE  hInstance,
LPVOID  lpParam 
)

Creates an OpenGL window.

Parameters
windowTitlethe title of the window (in windowed mode)
fullscreenshould fullscreen mode be used
classNamethe name of the window class
hInstancethe handle of the instance
lpParamsome parameter

Definition at line 82 of file OpenGLWindow.cpp.

float OpenGLWindow::getAspect ( void  )

Gets the aspect ratio of the window.

The aspect ratio is the ratio between height and width of the screen.

Returns
The aspect ratio.

Definition at line 191 of file OpenGLWindow.cpp.

HDC OpenGLWindow::getDC ( void  )
inline

Definition at line 60 of file OpenGLWindow.h.

FrustumInformation OpenGLWindow::getFrustum ( void  )

Returns the current frustum data which is updated on resize.

Returns
the data of the current frustum

Definition at line 247 of file OpenGLWindow.cpp.

unsigned int OpenGLWindow::getHeight ( void  )

Gets the height of the window.

Returns
The height of the window.

Definition at line 200 of file OpenGLWindow.cpp.

unsigned int OpenGLWindow::getLeft ( void  )

Gets the coordinate of the left corners. 0 if full screen.

Returns
The left most coordinate.

Definition at line 224 of file OpenGLWindow.cpp.

bool OpenGLWindow::getMouseClick ( void  )

Gets, if a mouse click occured.

Returns
true if click occured

Definition at line 389 of file OpenGLWindow.cpp.

Position OpenGLWindow::getMousePosition ( )

Gets the mouse position.

Returns
The mouse position.

Definition at line 370 of file OpenGLWindow.cpp.

unsigned int OpenGLWindow::getTop ( void  )

Gets the coordinate of the top corners. 0 if full screen.

Returns
The top most coordinate.

Definition at line 236 of file OpenGLWindow.cpp.

unsigned int OpenGLWindow::getWidth ( void  )

Gets the width of the window.

Returns
The width of the window.

Definition at line 212 of file OpenGLWindow.cpp.

bool OpenGLWindow::isFullscreen ( void  )

Returns true if the window is in fullscreen mode and false else.

Definition at line 254 of file OpenGLWindow.cpp.

void OpenGLWindow::keyDown ( unsigned char  i)
inline

Definition at line 39 of file OpenGLWindow.h.

bool OpenGLWindow::keyPressed ( unsigned char  i)
inline

Definition at line 40 of file OpenGLWindow.h.

void OpenGLWindow::keyUp ( unsigned char  i)
inline

Definition at line 41 of file OpenGLWindow.h.

void OpenGLWindow::kill ( void  )

Closes the window, release all ressources.

Return to desktop mode, if full screen was activated.

Definition at line 262 of file OpenGLWindow.cpp.

OpenGLWindow::operator HWND ( )
inline

Definition at line 63 of file OpenGLWindow.h.

GLvoid OpenGLWindow::reshape ( void  )

Update sthe member variables and the aspect ratio.

Resets the perspective projection.

Definition at line 289 of file OpenGLWindow.cpp.

void OpenGLWindow::setBits ( int  bits)
inline

Definition at line 52 of file OpenGLWindow.h.

void OpenGLWindow::setHeight ( unsigned int  height)

/brief Sets the new height for the window depending whether the window is in fullscreen mode or not.

Parameters
heightnew height of the window

Definition at line 335 of file OpenGLWindow.cpp.

void OpenGLWindow::setLeft ( unsigned int  left)

/brief Sets the new left position for the window, this is not used if the window is in fullscreen mode.

Parameters
leftthe new left position of the window

Definition at line 317 of file OpenGLWindow.cpp.

void OpenGLWindow::setMouseClick ( bool  click)

Sets, if a mouse click occured.

Parameters
clicktrue if click occured.

Definition at line 379 of file OpenGLWindow.cpp.

void OpenGLWindow::setMousePosition ( int  x,
int  y 
)

Sets a new mouse position.

Parameters
xThe x coordinate.
yThe y coordinate.

Definition at line 360 of file OpenGLWindow.cpp.

void OpenGLWindow::setTop ( unsigned int  top)

/brief Sets the new top position for the window, this is not used if the window is in fullscreen mode.

Parameters
topnew top position of the window

Definition at line 326 of file OpenGLWindow.cpp.

void OpenGLWindow::setWidth ( unsigned int  width)

/brief Sets the new height for the window depending whether the window is in fullscreen mode or not.

Parameters
widthnew width of the window

Definition at line 347 of file OpenGLWindow.cpp.

void OpenGLWindow::showMousePointer ( bool  mouseVisible)

Shows and hides the mouse pointer, but hiding takes place only in full screen mode.

Parameters
mouseVisibleif the mouse should be visible

Definition at line 399 of file OpenGLWindow.cpp.

void OpenGLWindow::swap ( void  )
inline

Definition at line 58 of file OpenGLWindow.h.


The documentation for this class was generated from the following files: