R-Type
Public Member Functions | List of all members
GameEngine::EventManager Class Reference

class to help create and manage all the event handlers More...

#include <Event.hpp>

Public Member Functions

template<class EventData = NoEventData>
EventHandler< EventData > & addHandler (EventType eventType)
 create a new event handler for the given event type More...
 
void removeHandler (const EventType eventType)
 remove an event handler More...
 
template<class EventData = NoEventData>
void publish (const EventType eventType, EventData eventData)
 call all the subscribed functions with the given eventData More...
 
template<class EventData = NoEventData>
EventHandler< EventData > & getHandler (const EventType eventType)
 return an event handler by its type More...
 

Detailed Description

class to help create and manage all the event handlers

Member Function Documentation

◆ addHandler()

template<class EventData = NoEventData>
EventHandler<EventData>& GameEngine::EventManager::addHandler ( EventType  eventType)
inline

create a new event handler for the given event type

Template Parameters
EventDatatype of the data to be send to subscribed functions when the event is published
Parameters
eventTypetype of the event for the new event handler
Returns
return a reference to the newly created event handler

◆ getHandler()

template<class EventData = NoEventData>
EventHandler<EventData>& GameEngine::EventManager::getHandler ( const EventType  eventType)
inline

return an event handler by its type

Template Parameters
EventDatatype of the data to send to subscribed functions when the event is published
Parameters
eventTypetype of the event handler to retrive
Returns
returns a reference to the event handler obtained

◆ publish()

template<class EventData = NoEventData>
void GameEngine::EventManager::publish ( const EventType  eventType,
EventData  eventData 
)
inline

call all the subscribed functions with the given eventData

Template Parameters
EventDatatype of the data to be send to subscribed functions when the event is published
Parameters
eventTypetype of the event to publish
eventDatadata to be given to subscribed functions

◆ removeHandler()

void GameEngine::EventManager::removeHandler ( const EventType  eventType)
inline

remove an event handler

Parameters
eventTypeevent type of the handler to remove

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