Mercurial > fife-parpg
diff engine/core/eventchannel/eventmanager.h @ 428:a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 22 Feb 2010 21:23:01 +0000 |
parents | bb9902910067 |
children | b312d170ab0c |
line wrap: on
line diff
--- a/engine/core/eventchannel/eventmanager.h Sat Feb 20 21:41:43 2010 +0000 +++ b/engine/core/eventchannel/eventmanager.h Mon Feb 22 21:23:01 2010 +0000 @@ -24,7 +24,7 @@ // Standard C++ library includes // -#include <vector> +#include <deque> #include <map> #include <list> @@ -64,11 +64,11 @@ /** Event Manager manages all events related to FIFE */ - class EventManager: + class EventManager: public ICommandController, - public IKeyController, - public IMouseController, - public ISdlEventController, + public IKeyController, + public IMouseController, + public ISdlEventController, public IEventSource, public ITriggerController { public: @@ -81,13 +81,17 @@ virtual ~EventManager(); void addCommandListener(ICommandListener* listener); + void addCommandListenerFront(ICommandListener* listener); void removeCommandListener(ICommandListener* listener); void dispatchCommand(Command& command); void addKeyListener(IKeyListener* listener); + void addKeyListenerFront(IKeyListener* listener); void removeKeyListener(IKeyListener* listener); void addMouseListener(IMouseListener* listener); + void addMouseListenerFront(IMouseListener* listener); void removeMouseListener(IMouseListener* listener); void addSdlEventListener(ISdlEventListener* listener); + void addSdlEventListenerFront(ISdlEventListener* listener); void removeSdlEventListener(ISdlEventListener* listener); EventSourceType getEventSourceType(); @@ -95,7 +99,7 @@ void unregisterTrigger(Trigger& trigger); /** Process the SDL event queue. - * This is to be called only by the engine itself once per frame. + * This is to be called only by the engine itself once per frame. * It passes appropriate events to their listeners */ void processEvents(); @@ -120,22 +124,26 @@ void fillMouseEvent(const SDL_Event& sdlevt, MouseEvent& mouseevt); void pollTriggers(); - - std::vector<ICommandListener*> m_commandlisteners; - std::vector<ICommandListener*> m_pending_commandlisteners; - std::vector<ICommandListener*> m_pending_cldeletions; + + std::deque<ICommandListener*> m_commandlisteners; + std::deque<ICommandListener*> m_pending_commandlisteners; + std::deque<ICommandListener*> m_pending_commandlisteners_front; + std::deque<ICommandListener*> m_pending_cldeletions; - std::vector<IKeyListener*> m_keylisteners; - std::vector<IKeyListener*> m_pending_keylisteners; - std::vector<IKeyListener*> m_pending_kldeletions; + std::deque<IKeyListener*> m_keylisteners; + std::deque<IKeyListener*> m_pending_keylisteners; + std::deque<IKeyListener*> m_pending_keylisteners_front; + std::deque<IKeyListener*> m_pending_kldeletions; - std::vector<IMouseListener*> m_mouselisteners; - std::vector<IMouseListener*> m_pending_mouselisteners; - std::vector<IMouseListener*> m_pending_mldeletions; + std::deque<IMouseListener*> m_mouselisteners; + std::deque<IMouseListener*> m_pending_mouselisteners; + std::deque<IMouseListener*> m_pending_mouselisteners_front; + std::deque<IMouseListener*> m_pending_mldeletions; - std::vector<ISdlEventListener*> m_sdleventlisteners; - std::vector<ISdlEventListener*> m_pending_sdleventlisteners; - std::vector<ISdlEventListener*> m_pending_sdldeletions; + std::deque<ISdlEventListener*> m_sdleventlisteners; + std::deque<ISdlEventListener*> m_pending_sdleventlisteners; + std::deque<ISdlEventListener*> m_pending_sdleventlisteners_front; + std::deque<ISdlEventListener*> m_pending_sdldeletions; std::map<int, bool> m_keystatemap; IKeyFilter* m_keyfilter;