|
FIFE
|
Event Manager manages all events related to FIFE. More...
#include <eventmanager.h>
Inheritance diagram for FIFE::EventManager:
Collaboration diagram for FIFE::EventManager:Public Member Functions | |
| EventManager () | |
| Constructor. More... | |
| virtual | ~EventManager () |
| Destructor. More... | |
| void | addCommandListener (ICommandListener *listener) |
| Adds a listener to the back of the listener deque Listener will be notified via the corresponding events. More... | |
| void | addCommandListenerFront (ICommandListener *listener) |
| Adds a listener to the front of the listener deque Listener will be notified via the corresponding events. More... | |
| void | removeCommandListener (ICommandListener *listener) |
| Removes an added listener from the controller. More... | |
| void | dispatchCommand (Command &command) |
| Use this method to send command to command listeners. More... | |
| void | addKeyListener (IKeyListener *listener) |
| Adds a listener to the back of the listener deque Listener will be notified via the corresponding events. More... | |
| void | addKeyListenerFront (IKeyListener *listener) |
| Adds a listener to the front of the listener deque Listener will be notified via the corresponding events. More... | |
| void | removeKeyListener (IKeyListener *listener) |
| Removes an added listener from the controller. More... | |
| void | addMouseListener (IMouseListener *listener) |
| Adds a listener to the back of the listener deque Listener will be notified via the corresponding events. More... | |
| void | addMouseListenerFront (IMouseListener *listener) |
| Adds a listener to the front of the listener deque Listener will be notified via the corresponding events. More... | |
| void | removeMouseListener (IMouseListener *listener) |
| Removes an added listener from the controller. More... | |
| void | addSdlEventListener (ISdlEventListener *listener) |
| Adds a listener to the back of the listener deque Listener will be notified via the corresponding events. More... | |
| void | addSdlEventListenerFront (ISdlEventListener *listener) |
| Adds a listener to the front of the listener deque Listener will be notified via the corresponding events. More... | |
| void | removeSdlEventListener (ISdlEventListener *listener) |
| Removes an added listener from the controller. More... | |
| EventSourceType | getEventSourceType () |
| Gets the source type of this event. More... | |
| void | processEvents () |
| Process the SDL event queue. More... | |
| void | setKeyFilter (IKeyFilter *keyFilter) |
| void | setMouseFilter (IMouseFilter *mouseFilter) |
| void | setMouseSensitivity (float sensitivity) |
| Sets mouse sensitivity The sensitivity is limited to the range -0.99 - 10.0. More... | |
| float | getMouseSensitivity () const |
| Gets mouse sensitivity. More... | |
| void | setMouseAccelerationEnabled (bool acceleration) |
| Sets mouse acceleration if mouse acceleration is enabled, then the mouse sensitivity is used as speed max. More... | |
| bool | isMouseAccelerationEnabled () const |
| Returns if mouse acceleration is enabled or not. More... | |
Public Member Functions inherited from FIFE::ICommandController | |
| virtual | ~ICommandController () |
Public Member Functions inherited from FIFE::IKeyController | |
| virtual | ~IKeyController () |
Public Member Functions inherited from FIFE::IMouseController | |
| virtual | ~IMouseController () |
Public Member Functions inherited from FIFE::ISdlEventController | |
| virtual | ~ISdlEventController () |
Public Member Functions inherited from FIFE::IEventSource | |
| virtual | ~IEventSource () |
Private Member Functions | |
| void | processActiveEvent (SDL_Event event) |
| void | processKeyEvent (SDL_Event event) |
| void | processMouseEvent (SDL_Event event) |
| bool | combineEvents (SDL_Event &event1, const SDL_Event &event2) |
| bool | dispatchSdlEvent (SDL_Event &evt) |
| void | dispatchKeyEvent (KeyEvent &evt) |
| void | dispatchMouseEvent (MouseEvent &evt) |
| void | fillModifiers (InputEvent &evt) |
| void | fillKeyEvent (const SDL_Event &sdlevt, KeyEvent &keyevt) |
| void | fillMouseEvent (const SDL_Event &sdlevt, MouseEvent &mouseevt) |
Event Manager manages all events related to FIFE.
Definition at line 67 of file eventmanager.h.
| FIFE::EventManager::EventManager | ( | ) |
Constructor.
Definition at line 47 of file eventmanager.cpp.
|
virtual |
Destructor.
Definition at line 67 of file eventmanager.cpp.
|
virtual |
Adds a listener to the back of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::ICommandController.
Definition at line 80 of file eventmanager.cpp.
References m_pending_commandlisteners.
|
virtual |
Adds a listener to the front of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::ICommandController.
Definition at line 84 of file eventmanager.cpp.
References m_pending_commandlisteners_front.
|
virtual |
Adds a listener to the back of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::IKeyController.
Definition at line 92 of file eventmanager.cpp.
References m_pending_keylisteners.
|
virtual |
Adds a listener to the front of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::IKeyController.
Definition at line 96 of file eventmanager.cpp.
References m_pending_keylisteners_front.
|
virtual |
Adds a listener to the back of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::IMouseController.
Definition at line 104 of file eventmanager.cpp.
References m_pending_mouselisteners.
|
virtual |
Adds a listener to the front of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::IMouseController.
Definition at line 108 of file eventmanager.cpp.
References m_pending_mouselisteners_front.
|
virtual |
Adds a listener to the back of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::ISdlEventController.
Definition at line 116 of file eventmanager.cpp.
References m_pending_sdleventlisteners.
|
virtual |
Adds a listener to the front of the listener deque Listener will be notified via the corresponding events.
| listener | listener to add |
Implements FIFE::ISdlEventController.
Definition at line 120 of file eventmanager.cpp.
References m_pending_sdleventlisteners_front.
|
private |
Definition at line 343 of file eventmanager.cpp.
Referenced by processEvents().
Here is the caller graph for this function:
|
virtual |
Use this method to send command to command listeners.
| command | command to dispatch |
Implements FIFE::ICommandController.
Definition at line 128 of file eventmanager.cpp.
References FIFE::Command::isConsumed(), m_commandlisteners, m_pending_cldeletions, m_pending_commandlisteners, and m_pending_commandlisteners_front.
Referenced by processActiveEvent(), and processEvents().
Here is the caller graph for this function:
|
private |
Definition at line 173 of file eventmanager.cpp.
References FIFE::KeyEvent::getType(), m_keylisteners, m_pending_keylisteners, m_pending_keylisteners_front, m_pending_kldeletions, FIFE::KeyEvent::PRESSED, and FIFE::KeyEvent::RELEASED.
Referenced by processKeyEvent().
Here is the caller graph for this function:
|
private |
Definition at line 224 of file eventmanager.cpp.
References FIFE::MouseEvent::CLICKED, FIFE::MouseEvent::DRAGGED, FIFE::MouseEvent::ENTERED, FIFE::MouseEvent::EXITED, FIFE::MouseEvent::getType(), FIFE::MouseEvent::isConsumed(), m_mouselisteners, m_pending_mldeletions, m_pending_mouselisteners, m_pending_mouselisteners_front, FIFE::MouseEvent::MOVED, FIFE::MouseEvent::PRESSED, FIFE::MouseEvent::RELEASED, FIFE::MouseEvent::WHEEL_MOVED_DOWN, and FIFE::MouseEvent::WHEEL_MOVED_UP.
Referenced by processMouseEvent().
Here is the caller graph for this function:
|
private |
Definition at line 299 of file eventmanager.cpp.
References m_pending_sdldeletions, m_pending_sdleventlisteners, m_pending_sdleventlisteners_front, and m_sdleventlisteners.
Referenced by processActiveEvent(), processKeyEvent(), and processMouseEvent().
Here is the caller graph for this function:
|
private |
Definition at line 599 of file eventmanager.cpp.
References FIFE::_log, FL_WARN, FIFE::KeyEvent::PRESSED, FIFE::KeyEvent::RELEASED, FIFE::KeyEvent::setAltPressed(), FIFE::KeyEvent::setControlPressed(), FIFE::KeyEvent::setKey(), FIFE::KeyEvent::setMetaPressed(), FIFE::KeyEvent::setNumericPad(), FIFE::KeyEvent::setShiftPressed(), and FIFE::KeyEvent::setType().
Referenced by processKeyEvent().
Here is the caller graph for this function:
|
private |
Definition at line 619 of file eventmanager.cpp.
References FIFE::Key::ALT_GR, FIFE::Key::LEFT_ALT, FIFE::Key::LEFT_CONTROL, FIFE::Key::LEFT_META, FIFE::Key::LEFT_SHIFT, m_keystatemap, FIFE::Key::RIGHT_ALT, FIFE::Key::RIGHT_CONTROL, FIFE::Key::RIGHT_META, FIFE::Key::RIGHT_SHIFT, FIFE::InputEvent::setAltPressed(), FIFE::InputEvent::setControlPressed(), FIFE::InputEvent::setMetaPressed(), and FIFE::InputEvent::setShiftPressed().
Referenced by processMouseEvent().
Here is the caller graph for this function:
|
private |
Definition at line 550 of file eventmanager.cpp.
References FIFE::MouseEvent::DRAGGED, FIFE::MouseEvent::EMPTY, FIFE::MouseEvent::getType(), FIFE::MouseEvent::LEFT, m_mostrecentbtn, m_mousestate, m_warp, FIFE::MouseEvent::MIDDLE, FIFE::MouseEvent::MOVED, FIFE::MouseEvent::PRESSED, FIFE::MouseEvent::RELEASED, FIFE::MouseEvent::RIGHT, FIFE::MouseEvent::setButton(), FIFE::MouseEvent::setType(), FIFE::MouseEvent::setX(), FIFE::MouseEvent::setY(), FIFE::MouseEvent::UNKNOWN_BUTTON, FIFE::MouseEvent::WHEEL_MOVED_DOWN, and FIFE::MouseEvent::WHEEL_MOVED_UP.
Referenced by processMouseEvent().
Here is the caller graph for this function:
|
virtual |
Gets the source type of this event.
Implements FIFE::IEventSource.
Definition at line 631 of file eventmanager.cpp.
References FIFE::ES_ENGINE.
| float FIFE::EventManager::getMouseSensitivity | ( | ) | const |
Gets mouse sensitivity.
Definition at line 652 of file eventmanager.cpp.
References m_mousesensitivity.
| bool FIFE::EventManager::isMouseAccelerationEnabled | ( | ) | const |
Returns if mouse acceleration is enabled or not.
Definition at line 660 of file eventmanager.cpp.
References m_acceleration.
|
private |
Definition at line 399 of file eventmanager.cpp.
References FIFE::CMD_APP_ICONIFIED, FIFE::CMD_APP_RESTORED, FIFE::CMD_INPUT_FOCUS_GAINED, FIFE::CMD_INPUT_FOCUS_LOST, FIFE::CMD_MOUSE_FOCUS_GAINED, FIFE::CMD_MOUSE_FOCUS_LOST, dispatchCommand(), dispatchSdlEvent(), m_enter, and FIFE::Command::setCommandType().
Referenced by processEvents().
Here is the caller graph for this function:| void FIFE::EventManager::processEvents | ( | ) |
Process the SDL event queue.
This is to be called only by the engine itself once per frame. It passes appropriate events to their listeners
Definition at line 360 of file eventmanager.cpp.
References FIFE::CMD_QUIT_GAME, combineEvents(), dispatchCommand(), processActiveEvent(), processKeyEvent(), processMouseEvent(), FIFE::Command::setCommandType(), and FIFE::Command::setSource().
Referenced by FIFE::Engine::initializePumping(), and FIFE::Engine::pump().
Here is the caller graph for this function:
|
private |
Definition at line 443 of file eventmanager.cpp.
References dispatchKeyEvent(), dispatchSdlEvent(), fillKeyEvent(), FIFE::KeyEvent::getKey(), FIFE::KeyEvent::getType(), FIFE::Key::getValue(), FIFE::IKeyFilter::isFiltered(), FIFE::Key::isFunctionKey(), m_keyfilter, m_keystatemap, FIFE::KeyEvent::PRESSED, and FIFE::KeyEvent::setSource().
Referenced by processEvents().
Here is the caller graph for this function:
|
private |
Definition at line 462 of file eventmanager.cpp.
References dispatchMouseEvent(), dispatchSdlEvent(), utf8::distance(), FIFE::Math< T >::Equal(), fillModifiers(), fillMouseEvent(), FIFE::RenderBackend::getArea(), FIFE::MouseEvent::getButton(), FIFE::RectType< T >::h, FIFE::DynamicSingleton< RenderBackend >::instance(), FIFE::IMouseFilter::isFiltered(), m_acceleration, m_enter, m_lastticks, m_mostrecentbtn, m_mousefilter, m_mousesensitivity, m_mousestate, m_oldvelocity, m_oldx, m_oldy, m_warp, FIFE::MouseEvent::setSource(), FIFE::Math< T >::Sqrt(), FIFE::RectType< T >::w, FIFE::RectType< T >::x, and FIFE::RectType< T >::y.
Referenced by processEvents().
Here is the caller graph for this function:
|
virtual |
Removes an added listener from the controller.
Listener will not be notified anymore via the corresponding events
| listener | listener to remove |
Implements FIFE::ICommandController.
Definition at line 88 of file eventmanager.cpp.
References m_pending_cldeletions.
|
virtual |
Removes an added listener from the controller.
Listener will not be notified anymore via the corresponding events
| listener | listener to remove |
Implements FIFE::IKeyController.
Definition at line 100 of file eventmanager.cpp.
References m_pending_kldeletions.
|
virtual |
Removes an added listener from the controller.
Listener will not be notified anymore via the corresponding events
| listener | listener to remove |
Implements FIFE::IMouseController.
Definition at line 112 of file eventmanager.cpp.
References m_pending_mldeletions.
|
virtual |
Removes an added listener from the controller.
Listener will not be notified anymore via the corresponding events
| listener | listener to remove |
Implements FIFE::ISdlEventController.
Definition at line 124 of file eventmanager.cpp.
References m_pending_sdldeletions.
| void FIFE::EventManager::setKeyFilter | ( | IKeyFilter * | keyFilter | ) |
Definition at line 635 of file eventmanager.cpp.
References m_keyfilter.
| void FIFE::EventManager::setMouseAccelerationEnabled | ( | bool | acceleration | ) |
Sets mouse acceleration if mouse acceleration is enabled, then the mouse sensitivity is used as speed max.
Definition at line 656 of file eventmanager.cpp.
References m_acceleration.
Referenced by FIFE::Engine::init().
Here is the caller graph for this function:| void FIFE::EventManager::setMouseFilter | ( | IMouseFilter * | mouseFilter | ) |
Definition at line 639 of file eventmanager.cpp.
References m_mousefilter.
| void FIFE::EventManager::setMouseSensitivity | ( | float | sensitivity | ) |
Sets mouse sensitivity The sensitivity is limited to the range -0.99 - 10.0.
Definition at line 643 of file eventmanager.cpp.
References m_mousesensitivity.
Referenced by FIFE::Engine::init().
Here is the caller graph for this function:
|
private |
Definition at line 180 of file eventmanager.h.
Referenced by isMouseAccelerationEnabled(), processMouseEvent(), and setMouseAccelerationEnabled().
|
private |
Definition at line 150 of file eventmanager.h.
Referenced by dispatchCommand().
|
private |
Definition at line 182 of file eventmanager.h.
Referenced by processActiveEvent(), and processMouseEvent().
|
private |
Definition at line 171 of file eventmanager.h.
Referenced by processKeyEvent(), and setKeyFilter().
|
private |
Definition at line 155 of file eventmanager.h.
Referenced by dispatchKeyEvent().
|
private |
Definition at line 170 of file eventmanager.h.
Referenced by fillModifiers(), and processKeyEvent().
|
private |
Definition at line 185 of file eventmanager.h.
Referenced by processMouseEvent().
|
private |
Definition at line 174 of file eventmanager.h.
Referenced by fillMouseEvent(), and processMouseEvent().
|
private |
Definition at line 172 of file eventmanager.h.
Referenced by processMouseEvent(), and setMouseFilter().
|
private |
Definition at line 160 of file eventmanager.h.
Referenced by dispatchMouseEvent().
|
private |
Definition at line 179 of file eventmanager.h.
Referenced by getMouseSensitivity(), processMouseEvent(), and setMouseSensitivity().
|
private |
Definition at line 173 of file eventmanager.h.
Referenced by fillMouseEvent(), and processMouseEvent().
|
private |
Definition at line 186 of file eventmanager.h.
Referenced by processMouseEvent().
|
private |
Definition at line 183 of file eventmanager.h.
Referenced by processMouseEvent().
|
private |
Definition at line 184 of file eventmanager.h.
Referenced by processMouseEvent().
|
private |
Definition at line 153 of file eventmanager.h.
Referenced by dispatchCommand(), and removeCommandListener().
|
private |
Definition at line 151 of file eventmanager.h.
Referenced by addCommandListener(), and dispatchCommand().
|
private |
Definition at line 152 of file eventmanager.h.
Referenced by addCommandListenerFront(), and dispatchCommand().
|
private |
Definition at line 156 of file eventmanager.h.
Referenced by addKeyListener(), and dispatchKeyEvent().
|
private |
Definition at line 157 of file eventmanager.h.
Referenced by addKeyListenerFront(), and dispatchKeyEvent().
|
private |
Definition at line 158 of file eventmanager.h.
Referenced by dispatchKeyEvent(), and removeKeyListener().
|
private |
Definition at line 163 of file eventmanager.h.
Referenced by dispatchMouseEvent(), and removeMouseListener().
|
private |
Definition at line 161 of file eventmanager.h.
Referenced by addMouseListener(), and dispatchMouseEvent().
|
private |
Definition at line 162 of file eventmanager.h.
Referenced by addMouseListenerFront(), and dispatchMouseEvent().
|
private |
Definition at line 168 of file eventmanager.h.
Referenced by dispatchSdlEvent(), and removeSdlEventListener().
|
private |
Definition at line 166 of file eventmanager.h.
Referenced by addSdlEventListener(), and dispatchSdlEvent().
|
private |
Definition at line 167 of file eventmanager.h.
Referenced by addSdlEventListenerFront(), and dispatchSdlEvent().
|
private |
Definition at line 165 of file eventmanager.h.
Referenced by dispatchSdlEvent().
|
private |
Definition at line 181 of file eventmanager.h.
Referenced by fillMouseEvent(), and processMouseEvent().