FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::LibRocketInputProcessor Class Reference

#include <librocketinputprocessor.h>

+ Collaboration diagram for FIFE::LibRocketInputProcessor:

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...
 

Detailed Description

Definition at line 47 of file librocketinputprocessor.h.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Parameters
evtThe SDL input.
Returns
A boolean value indicating if the event was consumed by librocket or not.

Definition at line 85 of file librocketinputprocessor.cpp.

References processKeyInput(), processMouseInput(), processMouseMotion(), processTextInput(), and updateKeyModState().

Referenced by FIFE::LibRocketManager::onSdlEvent().

+ Here is the caller graph for this function:

void FIFE::LibRocketInputProcessor::populateKeyMap ( )
private

Creates the key map.

Definition at line 213 of file librocketinputprocessor.cpp.

References m_keyMap.

Referenced by LibRocketInputProcessor().

+ Here is the caller graph for this function:

bool FIFE::LibRocketInputProcessor::processKeyInput ( SDL_Event &  event)
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().

+ Here is the caller graph for this function:

bool FIFE::LibRocketInputProcessor::processMouseInput ( SDL_Event &  event)
private

Process a mouse input event.

Definition at line 136 of file librocketinputprocessor.cpp.

References m_context, m_keyModState, and processMouseWheelMotion().

Referenced by onSdlEvent().

+ Here is the caller graph for this function:

bool FIFE::LibRocketInputProcessor::processMouseMotion ( SDL_Event &  event)
private

Process a mouse motion event.

Definition at line 126 of file librocketinputprocessor.cpp.

References m_context, and m_keyModState.

Referenced by onSdlEvent().

+ Here is the caller graph for this function:

bool FIFE::LibRocketInputProcessor::processMouseWheelMotion ( SDL_Event &  event)
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().

+ Here is the caller graph for this function:

bool FIFE::LibRocketInputProcessor::processTextInput ( SDL_Event &  event)
private

Process a text input event.

Definition at line 206 of file librocketinputprocessor.cpp.

References m_context.

Referenced by onSdlEvent().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

void FIFE::LibRocketInputProcessor::updateKeyModState ( )
private

Updates the key mod state bitmask.

Definition at line 49 of file librocketinputprocessor.cpp.

References m_keyModState.

Referenced by onSdlEvent().

+ Here is the caller graph for this function:

Member Data Documentation

Rocket::Core::Context* FIFE::LibRocketInputProcessor::m_context
private

Reference to librocket's context.

Definition at line 107 of file librocketinputprocessor.h.

Referenced by processKeyInput(), processMouseInput(), processMouseMotion(), processMouseWheelMotion(), processTextInput(), and turn().

std::map<SDL_Keycode, Rocket::Core::Input::KeyIdentifier> FIFE::LibRocketInputProcessor::m_keyMap
private

Keymap to convert SDL key to Librocket key.

Definition at line 121 of file librocketinputprocessor.h.

Referenced by populateKeyMap(), and processKeyInput().

uint32_t FIFE::LibRocketInputProcessor::m_keyModState
private

Bitmask that stores key modifiers.

Definition at line 111 of file librocketinputprocessor.h.

Referenced by processKeyInput(), processMouseInput(), processMouseMotion(), processMouseWheelMotion(), turn(), and updateKeyModState().

int32_t FIFE::LibRocketInputProcessor::m_wheelCounter
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().


The documentation for this class was generated from the following files: