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 | Static Public Member Functions | Protected Member Functions | Friends | List of all members
OpenGLApplication Class Referenceabstract

A basic class for an OpenGL application. More...

#include <OpenGLApplication.h>

Inheritance diagram for OpenGLApplication:
App

Public Member Functions

virtual ~OpenGLApplication (void)
 

Static Public Member Functions

static OpenGLApplicationcreate (const char *class_name)
 Create the derived application class and return a pointer to the OpenGLApplication base class.
 

Protected Member Functions

 OpenGLApplication (const char *className)
 Constructs an OpenGLApplication with a given name.
 
virtual bool initialize ()=0
 
virtual void deinitialize ()=0
 
virtual void update (DWORD milliseconds)=0
 
virtual void draw ()=0
 
OpenGLWindowgetWindow (void)
 Return the window that belongs tho this application instance.
 
void fastMode ()
 Disables face culling, lighting and the depth testing.
 
void fullMode ()
 Enables face culling, lighting and the depth testing.
 
void terminate ()
 This function is called if the application quits by sending the appropriate window message and stopping the main program loop.
 
void toggleFullscreen ()
 Switches between fullscreen and windowed displaymode.
 
void resizeDraw (bool enable)
 Enable or disable resizing while changing window size.
 
void setFrameLimit (unsigned int framesPerSecond)
 Sets frame limit. If the computer is faster than the frame limit, it is supposed not to render again.
 
unsigned int getFrameLimit ()
 Gets frame limit.
 
FrameCountergetFrameCounter ()
 Gets frame counter.
 

Friends

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 
LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 The window procedure handles the window messages for this application.
 

Detailed Description

A basic class for an OpenGL application.

Contains basic Windows related functions such as the message handler and important members used for graphic programming, such as screen width. Can toggle between full screen and windowed mode.

Supports virtual methods to draw a scene and update the datastructures in each frame.

Author
Jan-Philipp Kappmeier
Date
27/09/2012

Definition at line 25 of file OpenGLApplication.h.

Constructor & Destructor Documentation

OpenGLApplication::~OpenGLApplication ( void  )
virtual

Destructor

Definition at line 102 of file OpenGLApplication.cpp.

OpenGLApplication::OpenGLApplication ( const char *  className)
protected

Constructs an OpenGLApplication with a given name.

Initializes the main data structures, such as the world, the textures and the object list.

Parameters
classNameName of the window class that will belong to this application.

Definition at line 79 of file OpenGLApplication.cpp.

Member Function Documentation

OpenGLApplication * OpenGLApplication::create ( const char *  className)
static

Create the derived application class and return a pointer to the OpenGLApplication base class.

Parameters
classNameName of the window class.
Returns
the pointer to the class, or null if it fails.

Definition at line 60 of file App.cpp.

virtual void OpenGLApplication::deinitialize ( )
protectedpure virtual

Implemented in App.

virtual void OpenGLApplication::draw ( )
protectedpure virtual

Implemented in App.

void OpenGLApplication::fastMode ( )
protected

Disables face culling, lighting and the depth testing.

Very useful for 2D elements, as text or display-elements. It's supposed to use it not so often, as the switching costs time.

Definition at line 116 of file OpenGLApplication.cpp.

void OpenGLApplication::fullMode ( )
protected

Enables face culling, lighting and the depth testing.

Definition at line 126 of file OpenGLApplication.cpp.

FrameCounter * OpenGLApplication::getFrameCounter ( )
protected

Gets frame counter.

Returns
The frame counter.

Definition at line 140 of file OpenGLApplication.cpp.

unsigned int OpenGLApplication::getFrameLimit ( )
protected

Gets frame limit.

Returns
The frame limit if active, 0 otherwise.

Definition at line 152 of file OpenGLApplication.cpp.

OpenGLWindow * OpenGLApplication::getWindow ( void  )
protected

Return the window that belongs tho this application instance.

Definition at line 159 of file OpenGLApplication.cpp.

virtual bool OpenGLApplication::initialize ( )
protectedpure virtual

Implemented in App.

void OpenGLApplication::resizeDraw ( bool  draw)
protected

Enable or disable resizing while changing window size.

Parameters
drawthe status of disabling or resizing

Definition at line 167 of file OpenGLApplication.cpp.

void OpenGLApplication::setFrameLimit ( unsigned int  framesPerSecond)
protected

Sets frame limit. If the computer is faster than the frame limit, it is supposed not to render again.

Parameters
framesPerSecondThe frames per second.

Definition at line 369 of file OpenGLApplication.cpp.

void OpenGLApplication::terminate ( )
protected

This function is called if the application quits by sending the appropriate window message and stopping the main program loop.

The only thing that has to be done is to delete the window. Other things are done within the destructor.

Definition at line 179 of file OpenGLApplication.cpp.

void OpenGLApplication::toggleFullscreen ( )
protected

Switches between fullscreen and windowed displaymode.

Definition at line 187 of file OpenGLApplication.cpp.

virtual void OpenGLApplication::update ( DWORD  milliseconds)
protectedpure virtual

Implemented in App.

Friends And Related Function Documentation

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
int  nCmdShow 
)
friend

Definition at line 27 of file OpenGLApplication.cpp.

LRESULT CALLBACK WndProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
friend

The window procedure handles the window messages for this application.

If an window is being created we get the instance and save it. Otherwise all messages are passed to the message handler in the class.

Parameters
hWndHandle for the window
uMsgThe message that is to be handled
wParamAdditional information
lParamMore additional information

Definition at line 49 of file OpenGLApplication.cpp.


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