![]() |
AireEngine
A 3D Open-World Game Engine
|
#include <event.h>
Static Public Member Functions | |
| static void | registerForEvent (GameObject *obj, std::string eventType) |
| static void | unregisterFromEvent (GameObject *obj, std::string eventType) |
| static void | unregisterFromAllEvents (GameObject *obj) |
| static void | dispatchEvent (const Event &eventInstance) |
| static StagedEvent * | stageEvent (Event *eventToStage, float timer, bool destroyWhenDone) |
| static void | updateEventTimer (float dt) |
| static const HashSet< GameObject * > & | getAllRegisteredObjects (const std::string &eventType) |
| static const HashSet< std::string > & | getAllRegiteredEvents (GameObject *obj) |
| static void | freeMem () |
| Use this to free all memory used by internal static members. | |
Event manager to handle registering, unregistering, and dispatching events. Defined as a purely static class, so all methods are globally accessible. This simplifies the architecture as it does not require passing EventManager references around. The downside of this is that the used memory will be freed only when the application terminates.
Trigger an event. This calls the event handling method of all objects registered for this type of event.
| eventInstance | The event to trigger. |

|
inlinestatic |
Get the list of all objects registered for a given event type.
| eventType | The event type to query. |
|
inlinestatic |
Query all events an object is registered for.
| obj | The game object to query. |
|
inlinestatic |
Register and object for an event type. When the event is triggered, the object's event handling method will be called automatically. Does nothing if the object is already registered for the event
| obj | The game object to register. |
| eventType | The event type to register the event for (case sensitive). |
|
inlinestatic |
Stage an event for a later execution, after a fixed amount of time (in s).
| eventToStage | Event to stage for a delayed execution. |
| timer | Amound of time (in s) to wait before triggering the event |
| destroyWhenDone | If true, the event object will be automatically deleted. If false, responsibility of freeing the object is left to the user. |
|
inlinestatic |
Unregister a game object from all events it is registered for. Does nothing is the object is not registered to any events.
| obj | The game object to unregister. |

|
inlinestatic |
Unregister a game object from a given event type. If the object was not registered to the event, the method does nothing.
| obj | The game object to unregister. |
| eventType | The event type to register the event for (case sensitive). |
Update the timer of all staged events by decreasing it by dt seconds. To be called once every frame.
| dt | Time delta to decrease timers of staged events. |
