-
Notifications
You must be signed in to change notification settings - Fork 3
Events Subsystem
Jason El-Massih edited this page Jan 27, 2016
·
3 revisions
To prevent extensive calling across subsystems, a game event system is used to communicate between subsystems.
Events are created by inheriting BaseEventData, adding any additional data, serialization, or copy logic required by the event.
All events also need an EventType field defined with a GUID to be uniquely identified across the application.
To define callbacks for specific events, Bombast Engine uses the fastdelegate library. This allows a method to be bound to an existing event with the following code (In this example GameSampleLogic::StartMoveUpDelegate() will be called when the EvtData_StartUp event is emitted):
pEventManager->VAddListener(fastdelegate::MakeDelegate(this, &GameSampleLogic::StartMoveUpDelegate), EvtData_StartUp::sEventType);-
EventManager::VAddListeneris used to register a listener delegate -
EventManager::VRemoveListeneris used to remove a registered listener delegate -
EventManager::VTriggerEventemits a given event immediately to all listeners -
EventManager::VQueueEventemits a given event nextEventManager::VUpdate(Allows to be aborted viaEventManager::VAbortEvent)