SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::events::EventDispatcher Class Referencefinal

A class that dispatches events to the appropriate event handler. More...

#include <EventDispatcher.h>

Public Member Functions

 EventDispatcher (Event &event)
 Instantiates a new EventDispatcher for the given event.
 
 EventDispatcher (const EventDispatcher &other)=delete
 
 EventDispatcher (EventDispatcher &&other) noexcept=delete
 
EventDispatcheroperator= (const EventDispatcher &other)=delete
 
EventDispatcheroperator= (EventDispatcher &&other) noexcept=delete
 
template<typename T , typename F >
bool dispatch (const F &func)
 Dispatches the event to the appropriate event handler.
 

Detailed Description

A class that dispatches events to the appropriate event handler.

Constructor & Destructor Documentation

◆ EventDispatcher()

spark::events::EventDispatcher::EventDispatcher ( Event & event)
explicit

Instantiates a new EventDispatcher for the given event.

Parameters
eventthe event to dispatch.

Member Function Documentation

◆ dispatch()

template<typename T , typename F >
bool spark::events::EventDispatcher::dispatch ( const F & func)
nodiscard

Dispatches the event to the appropriate event handler.

Template Parameters
TThe type of the event to dispatch.
FThe type of the event handler (automatically deduced).
Parameters
funcThe event handler to call.
Returns
A boolean indicating whether the event was dispatched or not.