SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Dispatch()

template<typename T >
bool Spices::EventDispatcher::Dispatch ( EventFn< T > func)
inline

Dispatch the specific Event handle function pointer to Event Class.

Parameters
[in]funcSpecific Event handle function.
Returns
Returns true if execute function pointer.

If Specific Event handle function takes the same type with Stored Event type, will execute the function pointer.

Definition at line 182 of file Event.h.

183 {
185
190 if (m_Event.GetEventType() == T::GetStaticType())
191 {
192 m_Event.Handled = func(*static_cast<T*>(&m_Event));
193
194 return true;
195 }
196
197 return false;
198 }
#define SPICES_PROFILE_ZONE
Event & m_Event
Store the specific Event reference.
Definition Event.h:205
virtual EventType GetEventType() const =0
Event Information Function, must be implemented by EVENT_CLASS_TYPE and EVENT_CLASS_CATEGORY.
bool Handled
True if this event is handled.
Definition Event.h:148

References Spices::Event::GetEventType(), and m_Event.