Osiris Framework
0.2
|
The Osiris Application base class. More...
#include <OsirisSDK/OApplication.h>
Public Member Functions | |
OApplication (const char *title, int argc, char **argv, int windowPos_x=OAPPLICATION_DEFAULT_POSX, int windowPos_y=OAPPLICATION_DEFAULT_POSY, int windowWidth=OAPPLICATION_DEFAULT_WIDTH, int windowHeight=OAPPLICATION_DEFAULT_HEIGHT) | |
Class constructor. More... | |
virtual | ~OApplication () |
Class destructor. | |
OCamera * | camera () |
Returns the application camera object. More... | |
int | windowWidth () const |
Returns the window width in pixels. | |
int | windowHeight () const |
Returns the window height in pixels. | |
void | addEventRecipient (OEvent::EventType eventType, OObject *recipient) |
Adds an OObject class object as event recipient for given type. More... | |
void | removeEventRecipient (OEvent::EventType eventType, OObject *recipient) |
Removes an OObject class object as event recipient for given type. More... | |
void | start () |
Initializes the application and starts the main loop. | |
void | scheduleDelete (OObject *obj) |
Schedule an object for deletion at the end of the current loop. | |
Static Public Member Functions | |
static OApplication * | activeInstance () |
Returns active OApplication instance. | |
Protected Member Functions | |
virtual void | init ()=0 |
Method called prior to entering the main loop to initialize the OApplication object. | |
virtual void | clearScreen () |
Called in the begining of the render process for each loop to clear the previous screen. | |
void | queueEvent (OEvent *evt) |
Queue event to be processed by the application and the subscribed OOBject class objects. | |
void | processEvents () |
Process event queue. | |
void | deleteObjects () |
Remove objects previously scheduled for deletion. | |
virtual void | update (int timeIndex_ms)=0 |
Method called on each simulation iteration. | |
The Osiris Application base class.
This is the class that represents an application based on the Osiris Framework. It handles basic interaction with OpenGL, creating the window and handling main loop.
OApplication::OApplication | ( | const char * | title, |
int | argc, | ||
char ** | argv, | ||
int | windowPos_x = OAPPLICATION_DEFAULT_POSX , |
||
int | windowPos_y = OAPPLICATION_DEFAULT_POSY , |
||
int | windowWidth = OAPPLICATION_DEFAULT_WIDTH , |
||
int | windowHeight = OAPPLICATION_DEFAULT_HEIGHT |
||
) |
Class constructor.
The constructor creates the window and initializes OpenGL.
title | Application window title. |
argc | Number of command line arguments |
argv | Command line arguments. |
windowPos_x | Window position on the X axis. |
windowPos_y | Window position on the Y axis. |
windowWidth | Window width. |
windowHeight | Window height. |
void OApplication::addEventRecipient | ( | OEvent::EventType | eventType, |
OObject * | recipient | ||
) |
Adds an OObject class object as event recipient for given type.
eventType | Event type. |
recipient | Object that will receive the events. |
OCamera * OApplication::camera | ( | ) |
Returns the application camera object.
void OApplication::removeEventRecipient | ( | OEvent::EventType | eventType, |
OObject * | recipient | ||
) |
Removes an OObject class object as event recipient for given type.
eventType | Event type. |
recipient | Object that will receive the events. |