EventManager Class Reference

Models hub for all SDL events (singleton). More...

#include <EventManager.h>

Inheritance diagram for EventManager:

Object

List of all members.

Public Member Functions

void processEvents ()
 Processes all events that occured after the last call.
void registerListener (EventListener *newListener)
 Registers a new listener.
void unregisterListener (EventListener *oldListener)
 Unregisters a certain listener.
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Static Public Member Functions

static EventManagergetInstance ()
 Getter for configuration.

Private Member Functions

 EventManager ()
 Constructor.
 ~EventManager ()
 Destructor.

Private Attributes

list< EventListener * > listeners
 All registered listeners.
SDL_Event * current
 The current/last processed event.
SDL_Joystick * joystick
 The joystick/gamepad if used.

Static Private Attributes

static EventManagerinstance = 0
 The singleton instance.


Detailed Description

Models hub for all SDL events (singleton).

The EventManager retrieves all SDL related events and delivers them to all interested components.


Constructor & Destructor Documentation

EventManager::EventManager (  )  [private]

Constructor.

Standard constructor (only called once)

EventManager::~EventManager (  )  [private]

Destructor.

Standard destructor (only called at program termination)


Member Function Documentation

EventManager * EventManager::getInstance (  )  [static]

Getter for configuration.

Creates the singleton instance if there isn't any.

void EventManager::processEvents (  ) 

Processes all events that occured after the last call.

Looks through all events that have occured since the last call and notifies registered listeners

void EventManager::registerListener ( EventListener newListener  ) 

Registers a new listener.

Will be ignored if the listener is already registered.

Parameters:
newListener The listener that shall be registered

void EventManager::unregisterListener ( EventListener oldListener  ) 

Unregisters a certain listener.

Will be ignored if the listener is not registered

Parameters:
oldListener The listener that shall be unregistered

string EventManager::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Reimplemented from Object.

string EventManager::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Reimplemented from Object.

enum classId EventManager::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Reimplemented from Object.


Member Data Documentation

EventManager * EventManager::instance = 0 [static, private]

The singleton instance.

The sole instance of this object.

All registered listeners.

SDL_Event* EventManager::current [private]

The current/last processed event.

SDL_Joystick* EventManager::joystick [private]

The joystick/gamepad if used.


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

Generated on Mon Jul 7 13:30:33 2008 for Firefly by  doxygen 1.5.6