mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
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 () | |
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.
Definition at line 21 of file OpenGLWindow.h.
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.
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.
windowTitle | the title of the window (in windowed mode) |
fullscreen | should fullscreen mode be used |
className | the name of the window class |
hInstance | the handle of the instance |
lpParam | some 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.
Definition at line 191 of file OpenGLWindow.cpp.
|
inline |
Definition at line 60 of file OpenGLWindow.h.
FrustumInformation OpenGLWindow::getFrustum | ( | void | ) |
Returns the current frustum data which is updated on resize.
Definition at line 247 of file OpenGLWindow.cpp.
unsigned int OpenGLWindow::getHeight | ( | void | ) |
Gets 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.
Definition at line 224 of file OpenGLWindow.cpp.
bool OpenGLWindow::getMouseClick | ( | void | ) |
Gets, if a mouse click occured.
Definition at line 389 of file OpenGLWindow.cpp.
Position OpenGLWindow::getMousePosition | ( | ) |
Gets 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.
Definition at line 236 of file OpenGLWindow.cpp.
unsigned int OpenGLWindow::getWidth | ( | void | ) |
Gets 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.
|
inline |
Definition at line 39 of file OpenGLWindow.h.
|
inline |
Definition at line 40 of file OpenGLWindow.h.
|
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.
|
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.
|
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.
height | new 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.
left | the 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.
click | true if click occured. |
Definition at line 379 of file OpenGLWindow.cpp.
void OpenGLWindow::setMousePosition | ( | int | x, |
int | y | ||
) |
Sets a new mouse position.
x | The x coordinate. |
y | The 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.
top | new 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.
width | new 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.
mouseVisible | if the mouse should be visible |
Definition at line 399 of file OpenGLWindow.cpp.
|
inline |
Definition at line 58 of file OpenGLWindow.h.