Bromeon
Public Types | Public Member Functions
thor::SfmlEventSystem Class Reference

Class for object-oriented handling of SFML events. More...

Inheritance diagram for thor::SfmlEventSystem:
Inheritance graph

List of all members.

Public Types

typedef std::tr1::function
< void(const sf::Event &) > 
Listener
 Function type of listeners associated with Event.

Public Member Functions

 SfmlEventSystem (sf::Window &window)
 Constructor.
void PollEvents ()
 Polls events from the window and calls appropriate listeners.
Connection ForwardEvents (const Listener &receiver)
 Forwards all events to a specific receiver.
void ClearEventForwarders ()
 Removes all connections of events that are forwarded.
void TriggerEvent (const sf::Event &event)
 Fires an event.
Connection Connect (const sf::Event::EventType &trigger, const Listener &listener)
 Connects an event to the specified listener.
void ClearConnections (sf::Event::EventTypeidentifier)
 Disconnects listeners associated with a given event type.
void ClearAllConnections ()
 Disconnects all listeners.

Detailed Description

Class for object-oriented handling of SFML events.

Polls events of a window and forwards them to specific event listeners.


Constructor & Destructor Documentation

thor::SfmlEventSystem::SfmlEventSystem ( sf::Window &  window) [explicit]

Constructor.

Parameters:
windowThe window from which events are going to be polled.

Member Function Documentation

void thor::EventSystem< sf::Event , sf::Event::EventType >::ClearAllConnections ( ) [inherited]

Disconnects all listeners.

Removes all event-listener connections, independently of the event type.

void thor::EventSystem< sf::Event , sf::Event::EventType >::ClearConnections ( sf::Event::EventType  identifier) [inherited]

Disconnects listeners associated with a given event type.

Parameters:
identifierThe event type identifier of which you want to remove all connected listeners.

Removes all connections of events that are forwarded.

Disconnects all event connections that have been set up with ForwardEvents().

Connection thor::EventSystem< sf::Event , sf::Event::EventType >::Connect ( const sf::Event::EventType &  trigger,
const Listener listener 
) [inherited]

Connects an event to the specified listener.

Duplicates are allowed (thus, the listener is invoked multiple times).

Parameters:
triggerThe event you want to associate with a listener function.
listenerThe function that is invoked when a trigger event is fired.
Returns:
A connection which can be used to remove the listener. If you don't need this functionality, just ignore the return value.

Forwards all events to a specific receiver.

This invokes the receiver function object for every event in the queue of the sf::Window (not just events of a given type). That can be useful for things like GUI hierarchies depending on events, too.

Parameters:
receiverFunction object that is called upon events.
Returns:
Connection allowing to remove this receiver from the forwarded events.
void thor::EventSystem< sf::Event , sf::Event::EventType >::TriggerEvent ( const sf::Event &  event) [inherited]

Fires an event.

Calls all listener functions that are currently associated with event.


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