- Main Page
- Classes
- Files

- File List
- File Members

# C:/Users/Public/AGS Final Folder/BFLETCHER D4010283/Source/Game/Source/EventManager.h

Go to the documentation of this file.

    00001 #ifndef _EVENTMANAGER_H_
    00002 #define _EVENTMANAGER_H_
    00003
    00004 #include "TSingleton.h"
    00005
    00006 #include "IEvent.h"
    00007 #include "IEventListener.h"
    00008 #include "HashString.h"
    00009
    00010 #include <vector>
    00011 #include <queue>
    00012
    00013 class EventManager : public TSingleton<EventManager>
    00014 {
    00015         public:
    00016         EventManager();
    00017         ~EventManager();
    00018
    00019         void ProcessQueue(unsigned int totalTime = 0);
    00020
    00021         void AddEventListener(const HashString &eventType, IEventListener* pListener);
    00022         void RemoveEventListener(const HashString &eventType, IEventListener* pListener);
    00023         void RemoveEventListenerFromAll(IEventListener* pListener);
    00024
    00025         void TriggerEvent(IEvent* pEvent);
    00026         void QueueEvent(IEvent* pEvent);
    00027
    00028         protected:
    00029         struct EventListenerSet
    00030         {
    00031                 HashString EventType;
    00032                 std::vector<IEventListener*> EventListeners;
    00033         };
    00034
    00035         EventListenerSet* GetListenerSet(const HashString &eventType);
    00036
    00037         std::vector<EventListenerSet*> m_vEventListenerSets;
    00038         std::queue<IEvent*> m_qEventQueue;
    00039 };
    00040
    00041 #endif