Gel2D - The free/open source game creation suite

Public Member Functions | Protected Member Functions
gel::GelAppBase Class Reference

Reimplementable base class for your Gel2D application. More...

#include <gelAppBase.h>

Inheritance diagram for gel::GelAppBase:
gel::GelEventReceiver

List of all members.

Public Member Functions

 GelAppBase ()
 Constructor.
virtual ~GelAppBase ()
 Destructor.
void start ()
 Starts the game loop.

Protected Member Functions

virtual bool update ()
 The frame function that will be called in the game loop.
virtual void render ()
 The draw function that will be called in the game loop.
virtual void mainLoop ()
 The game loop.
void setFPS (int _fps)
 Sets the frame rate.
int getFPS ()
 Gets the frame rate.

Detailed Description

Reimplementable base class for your Gel2D application.

This class serves as an inheritable template for your app.


Constructor & Destructor Documentation

gel::GelAppBase::GelAppBase ( )

Constructor.

virtual gel::GelAppBase::~GelAppBase ( ) [virtual]

Destructor.


Member Function Documentation

void gel::GelAppBase::start ( )

Starts the game loop.

This function will call mainloop().

virtual bool gel::GelAppBase::update ( ) [protected, virtual]

The frame function that will be called in the game loop.

The function must take no parameters and return bool.
This is the function you should put all of your game logic in.
To terminate the game loop, the function should return false, otherwise, it should return true.

virtual void gel::GelAppBase::render ( ) [protected, virtual]

The draw function that will be called in the game loop.

All rendering code should go here.

virtual void gel::GelAppBase::mainLoop ( ) [protected, virtual]

The game loop.

This function calls the frame and render functions, then polls for events.
You can reimplement this function as well, although it isn't necessary.

void gel::GelAppBase::setFPS ( int  _fps) [inline, protected]

Sets the frame rate.

By default, the fps is set to 60.
If you set the fps to 0, it will run unlimited.

Parameters:
_fps: The new frame speed in seconds.
int gel::GelAppBase::getFPS ( ) [inline, protected]

Gets the frame rate.

Returns:
The frame speed in seconds.

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