|
Saga
Saga Game Engine
|
A mapping between events (which are ints under the hood) and callbacks. More...
#include <eventmap.h>
Public Types | |
| enum | Id : uint64_t |
| typedef Map::iterator | iterator |
| typedef Map::const_iterator | const_iterator |
| typedef Map::value_type | value_type |
Public Member Functions | |
| const_iterator | begin () const |
| const_iterator | end () const |
| iterator | begin () |
| iterator | end () |
| template<typename Event > | |
| iterator | find (Event event) |
| template<typename Event > | |
| const_iterator | find (Event event) const |
| template<typename Event , typename ... DataType> | |
| Id | addListener (Event event, std::shared_ptr< std::function< void(DataType...)> > callbackFunc) |
| Add a listener to a specific event. | |
| template<typename Event > | |
| void | removeListener (Event event, Id id) |
| Remove a listener from an event, by their id. | |
| template<typename Event , typename ... DataType> | |
| void | invoke (Event event, DataType... args) |
| Invoke an event. This calls all listeners attached to that event, with the specified parameters. | |
A mapping between events (which are ints under the hood) and callbacks.
| typedef Map::const_iterator Saga::EventMap::const_iterator |
| typedef Map::iterator Saga::EventMap::iterator |
| typedef Map::value_type Saga::EventMap::value_type |
| enum Saga::EventMap::Id : uint64_t |
|
inline |
Add a listener to a specific event.
| Event | anything castable to an int. |
| DataType | the type of data the callback function accepts. |
| event | |
| callbackFunc | the callback that happens when this event is triggered. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Invoke an event. This calls all listeners attached to that event, with the specified parameters.
| Event | anything castable to an int. |
| DataType |
| event | |
| args | the parameters used in calling the listeners. |
|
inline |
Remove a listener from an event, by their id.
| Event | anything castable to an int. |
| event | |
| id |