Tramway SDK
|
Smart wrapper class for Event listeners. More...
#include <framework/event.h>
Public Member Functions | |
~EventListener () | |
void | make (event_t event, Entity *parent) |
Essentially same as Event::AddListener(). More... | |
void | make (event_t event, EntityComponent *parent) |
Essentially same as Event::AddListener(). More... | |
void | make (event_t event, void(*handler)(Event &event)) |
Essentially same as Event::AddListener(). More... | |
void | clear () |
Essentially same as Event::RemoveListener(). More... | |
operator bool () | |
Protected Attributes | |
listener_t | listener = 0 |
Smart wrapper class for Event listeners.
Calling the make() method will initialize the event listener, just like calling Event::AddListener() will do. Calling the clear() method will delete the listener, just like calling Event::RemoveListener() will do.
When this class is destroyed, the event listener will also be automatically removed.
You can also call the make() and clear() methods as much as you want, no resources will be leaked. Any existing event listener will be removed before a new one gets added.
tram::EventListener::~EventListener | ( | ) |
void tram::EventListener::clear | ( | ) |
Essentially same as Event::RemoveListener().
Essentially same as Event::AddListener().
void tram::EventListener::make | ( | event_t | event, |
EntityComponent * | parent | ||
) |
Essentially same as Event::AddListener().
Essentially same as Event::AddListener().
|
inlineexplicit |
|
protected |