Made EventManager class static
This commit is contained in:
@@ -9,19 +9,13 @@
|
||||
namespace Bloom
|
||||
{
|
||||
/**
|
||||
* The EventManager class provides a method of dispatching events to a set of listeners.
|
||||
* A single instance of this class is created in Application class. That instance is then passed by references to
|
||||
* all other components in Bloom, that require the ability to trigger events.
|
||||
*
|
||||
* @TODO: Should this be a static class? As in, all methods and variables declared static. We seem to be
|
||||
* using it in that way. It would save us from having to pass around that single instance by reference.
|
||||
* Something to consider.
|
||||
* The static EventManager class provides a method of dispatching events to a set of listeners.
|
||||
*/
|
||||
class EventManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Registers an EventListener instance with this manager.
|
||||
* Registers an EventListener instance with the manager.
|
||||
*
|
||||
* All EventListener instances must be registered with the EventManager before any events can
|
||||
* be dispatched to them.
|
||||
@@ -30,7 +24,7 @@ namespace Bloom
|
||||
*
|
||||
* @param listenerName
|
||||
*/
|
||||
void registerListener(std::shared_ptr<EventListener> listener);
|
||||
static void registerListener(std::shared_ptr<EventListener> listener);
|
||||
|
||||
/**
|
||||
* Deregister an EventListener instance.
|
||||
@@ -38,7 +32,7 @@ namespace Bloom
|
||||
* @param listenerId
|
||||
* The ID of the EventListener to deregister. See EventListener::getId();
|
||||
*/
|
||||
void deregisterListener(size_t listenerId);
|
||||
static void deregisterListener(size_t listenerId);
|
||||
|
||||
/**
|
||||
* Dispatches an event to all registered listeners, if they have registered an interest in the event type.
|
||||
@@ -46,7 +40,7 @@ namespace Bloom
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
void triggerEvent(const Events::SharedGenericEventPointer& event);
|
||||
static void triggerEvent(const Events::SharedGenericEventPointer& event);
|
||||
|
||||
/**
|
||||
* Checks if any registered listener is listening for a particular event type.
|
||||
@@ -54,7 +48,7 @@ namespace Bloom
|
||||
* @param eventType
|
||||
* @return
|
||||
*/
|
||||
bool isEventTypeListenedFor(Events::EventType eventType);
|
||||
static bool isEventTypeListenedFor(Events::EventType eventType);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user