Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_TimerObject Class Reference

Collaboration diagram for PG_TimerObject:

Collaboration graph
[legend]
List of all members.

Detailed Description

A class to handle periodical timers.

Author:
Alexander Pipelka

This class encapsulates the SDL_AddTimer, SDL_RemoveTimer functions.


Public Member Functions

 PG_TimerObject ()
 Constructor of the PG_TimerObject class.

virtual ~PG_TimerObject ()
PG_TimerID AddTimer (Uint32 interval)
 Add a timer to the object.

bool RemoveTimer (PG_TimerID id)
 Remove a timer.

int SetTimer (Uint32 interval)
void StopTimer ()
virtual Uint32 eventTimer (PG_TimerID id, Uint32 interval)
 timer event handler

virtual Uint32 eventTimer (Uint32 interval)

Public Attributes

SignalTimer sigTimer


Constructor & Destructor Documentation

PG_TimerObject::PG_TimerObject  ) 
 

Constructor of the PG_TimerObject class.

The constructor also calls SDL_InitSubSystem(SDL_Timer) to enable the SDL timer subsystem.

virtual PG_TimerObject::~PG_TimerObject  )  [virtual]
 


Member Function Documentation

PG_TimerID PG_TimerObject::AddTimer Uint32  interval  ) 
 

Add a timer to the object.

Parameters:
interval timer intervall in ms
Returns:
id of the timer
You can add any number of timers to an object. After the timer-interval the virtual function eventTimer(PG_TimerID id, Uint32 interval) will be called

virtual Uint32 PG_TimerObject::eventTimer Uint32  interval  )  [virtual]
 

virtual Uint32 PG_TimerObject::eventTimer PG_TimerID  id,
Uint32  interval
[virtual]
 

timer event handler

Parameters:
id id of the elapsed timer
interval timer interval
Returns:
should return the interval of the next timer event

bool PG_TimerObject::RemoveTimer PG_TimerID  id  ) 
 

Remove a timer.

Parameters:
id id of the timer to remove

int PG_TimerObject::SetTimer Uint32  interval  ) 
 

void PG_TimerObject::StopTimer  ) 
 


Member Data Documentation

SignalTimer PG_TimerObject::sigTimer
 



The ParaGUI Project - Alexander Pipelka