PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Public Member Functions | Public Attributes | List of all members
EventQueue< T > Class Template Reference

Event queue. More...

#include <event_queue.h>

Public Member Functions

 EventQueue (const EventQueue &eq)
 
void processEvents (float timeStep=1.0f)
 
void abort ()
 

Public Attributes

float left_time
 
QQueue< EventQueueEntry< T > > events
 

Detailed Description

template<class T>
class EventQueue< T >

Event queue.

Event queue provides sequenced and timed event processing.

How to use:

1) Create object:

EventQueue<ParentClass > myEventQueue;

2) Add into loop the calling of the processor which triggers events in queue

myEventQueue.processEvents(ticks);

where ticks - is a number of milliseconds time of each loop.

3) when in some case you wanna process bunch of events

EventQueueEntry<WorldScene >event1; event1.makeCaller(this, &myFunction, 1000);

myEventQueue.push_back(event1)

We are added an event to execute function after 1000 milliseconds past previouse event. If event queue is empty, this event will be triggered in next loop step with waiting of 1000 millisecods

4) If you wish abort all events in loop, call the abort() function inside myEventQueue.abort();


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