FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#include <librocketinputprocessor.h>
Public Member Functions | |
LibRocketInputProcessor (Rocket::Core::Context *context) | |
Constructor. More... | |
~LibRocketInputProcessor () | |
Destructor. More... | |
bool | onSdlEvent (SDL_Event &evt) |
Processes SDL input and converts it to librocket input, then forwards it to the librocket context. More... | |
void | turn () |
Called each frame to perform update operations. More... | |
Private Member Functions | |
void | updateKeyModState () |
Updates the key mod state bitmask. More... | |
bool | processMouseMotion (SDL_Event &event) |
Process a mouse motion event. More... | |
bool | processMouseInput (SDL_Event &event) |
Process a mouse input event. More... | |
bool | processMouseWheelMotion (SDL_Event &event) |
Process a mouse wheel motion event. More... | |
bool | processKeyInput (SDL_Event &event) |
Process a key input event. More... | |
bool | processTextInput (SDL_Event &event) |
Process a text input event. More... | |
void | populateKeyMap () |
Creates the key map. More... | |
Private Attributes | |
Rocket::Core::Context * | m_context |
Reference to librocket's context. More... | |
uint32_t | m_keyModState |
Bitmask that stores key modifiers. More... | |
int32_t | m_wheelCounter |
Counts how many times the wheel has been moved. More... | |
std::map< SDL_Keycode, Rocket::Core::Input::KeyIdentifier > | m_keyMap |
Keymap to convert SDL key to Librocket key. More... | |
Definition at line 47 of file librocketinputprocessor.h.
FIFE::LibRocketInputProcessor::LibRocketInputProcessor | ( | Rocket::Core::Context * | context | ) |
Constructor.
Definition at line 38 of file librocketinputprocessor.cpp.
References populateKeyMap().
FIFE::LibRocketInputProcessor::~LibRocketInputProcessor | ( | ) |
Destructor.
Definition at line 46 of file librocketinputprocessor.cpp.
bool FIFE::LibRocketInputProcessor::onSdlEvent | ( | SDL_Event & | evt | ) |
Processes SDL input and converts it to librocket input, then forwards it to the librocket context.
NOTE There is no way to get, if an event is consumed by Rocket currently. This is for in case it gets implemented in the future.
evt | The SDL input. |
Definition at line 85 of file librocketinputprocessor.cpp.
References processKeyInput(), processMouseInput(), processMouseMotion(), processTextInput(), and updateKeyModState().
Referenced by FIFE::LibRocketManager::onSdlEvent().
|
private |
Creates the key map.
Definition at line 213 of file librocketinputprocessor.cpp.
References m_keyMap.
Referenced by LibRocketInputProcessor().
|
private |
Process a key input event.
Definition at line 187 of file librocketinputprocessor.cpp.
References m_context, m_keyMap, and m_keyModState.
Referenced by onSdlEvent().
|
private |
Process a mouse input event.
Definition at line 136 of file librocketinputprocessor.cpp.
References m_context, m_keyModState, and processMouseWheelMotion().
Referenced by onSdlEvent().
|
private |
Process a mouse motion event.
Definition at line 126 of file librocketinputprocessor.cpp.
References m_context, and m_keyModState.
Referenced by onSdlEvent().
|
private |
Process a mouse wheel motion event.
Definition at line 154 of file librocketinputprocessor.cpp.
References m_context, m_keyModState, and m_wheelCounter.
Referenced by processMouseInput().
|
private |
Process a text input event.
Definition at line 206 of file librocketinputprocessor.cpp.
References m_context.
Referenced by onSdlEvent().
void FIFE::LibRocketInputProcessor::turn | ( | ) |
Called each frame to perform update operations.
Definition at line 119 of file librocketinputprocessor.cpp.
References m_context, m_keyModState, and m_wheelCounter.
Referenced by FIFE::LibRocketManager::turn().
|
private |
Updates the key mod state bitmask.
Definition at line 49 of file librocketinputprocessor.cpp.
References m_keyModState.
Referenced by onSdlEvent().
|
private |
Reference to librocket's context.
Definition at line 107 of file librocketinputprocessor.h.
Referenced by processKeyInput(), processMouseInput(), processMouseMotion(), processMouseWheelMotion(), processTextInput(), and turn().
|
private |
Keymap to convert SDL key to Librocket key.
Definition at line 121 of file librocketinputprocessor.h.
Referenced by populateKeyMap(), and processKeyInput().
|
private |
Bitmask that stores key modifiers.
Definition at line 111 of file librocketinputprocessor.h.
Referenced by processKeyInput(), processMouseInput(), processMouseMotion(), processMouseWheelMotion(), turn(), and updateKeyModState().
|
private |
Counts how many times the wheel has been moved.
Negative value means that the wheel has been moved abs(m_wheelCounter) upwards, positive value means that the wheel has been moved m_wheelCounter times downwards.
Definition at line 117 of file librocketinputprocessor.h.
Referenced by processMouseWheelMotion(), and turn().