#include <OMKInputListener.h>
Inheritance diagram for OMK::Inp::InputListener:
Public Member Functions | |
virtual | ~InputListener () |
const Name & | getId () const |
Static Public Member Functions | |
static OIS::KeyCode | retrieveCode (const std::string &code) |
Get the OIS code from the name of a key (string). | |
static bool | retrieveCodeFromConfig (const ConfigurationParameterDescriptor *node, const std::string &keyId, OIS::KeyCode &keyCode) |
Get the OIS code from a key id read in a configuration file. | |
Protected Member Functions | |
InputListener (ExtensibleSimulatedObject *sender, const Name &id, const ConfigurationParameterDescriptor *node) | |
The parameters of the constructor. | |
void | sendEvent (const Name &receiver, const EventIdentifier &eventId) |
template<typename UserType> | |
void | sendValuedEvent (const Name &receiver, const EventIdentifier &eventId, const UserType &prm) |
Protected Attributes | |
Name | _id |
ExtensibleSimulatedObject * | _sender |
Definition at line 53 of file OMKInputListener.h.
InputListener::InputListener | ( | ExtensibleSimulatedObject * | sender, | |
const Name & | id, | |||
const ConfigurationParameterDescriptor * | node | |||
) | [protected] |
InputListener::~InputListener | ( | ) | [virtual] |
OIS::KeyCode InputListener::retrieveCode | ( | const std::string & | code | ) | [static] |
Get the OIS code from the name of a key (string).
Definition at line 200 of file OMKInputListener.cpp.
References initCodes().
Referenced by retrieveCodeFromConfig().
00201 { 00202 // May be not thread safe 00203 static bool keyCodesRetrieved = false ; 00204 static std::map< std::string, OIS::KeyCode > s_keyCodes ; 00205 if( !keyCodesRetrieved ) 00206 { // try to retreive key codes only once per OMK session 00207 keyCodesRetrieved = true ; 00208 initCodes( s_keyCodes ) ; 00209 } 00210 00211 std::string str( code ) ; 00212 std::transform( str.begin(), str.end(), str.begin(), toupper ); 00213 return s_keyCodes[ str ] ; 00214 }
bool InputListener::retrieveCodeFromConfig | ( | const ConfigurationParameterDescriptor * | node, | |
const std::string & | keyId, | |||
OIS::KeyCode & | keyCode | |||
) | [static] |
Get the OIS code from a key id read in a configuration file.
[in] | node | The configuration node to find (or not) the keyId |
[in] | keyId | The name of the key in the configuration node |
[out] | keyCode | Returns the OIS code for the read keyId |
Definition at line 217 of file OMKInputListener.cpp.
References OMK::ParametersAccessor::get(), and retrieveCode().
00221 { 00222 std::string keyVal ; 00223 if( ParametersAccessor::get( node, keyId, keyVal ) ) 00224 { 00225 OIS::KeyCode k( retrieveCode( keyVal ) ) ; 00226 if( k != OIS::KC_UNASSIGNED ) 00227 { 00228 keyCode = k ; 00229 return true ; 00230 } 00231 } 00232 return false ; 00233 }
const Name & OMK::Inp::InputListener::getId | ( | ) | const [inline] |
void InputListener::sendEvent | ( | const Name & | receiver, | |
const EventIdentifier & | eventId | |||
) | [protected] |
Definition at line 45 of file OMKInputListener.cpp.
References _sender, and OMK::SimulatedObject::sendEvent().
Referenced by OMK::Inp::KeyListener::sendKeyEvent().
void OMK::Inp::InputListener::sendValuedEvent | ( | const Name & | receiver, | |
const EventIdentifier & | eventId, | |||
const UserType & | prm | |||
) | [inline, protected] |
Definition at line 91 of file OMKInputListener.h.
References _sender, and OMK::SimulatedObject::sendValuedEvent().
00092 { 00093 _sender->sendValuedEvent( receiver, eventId, prm ) ; 00094 }
Name OMK::Inp::InputListener::_id [protected] |
Definition at line 87 of file OMKInputListener.h.
Referenced by InputListener(), OMK::Inp::EscListener::keyPressed(), OMK::Inp::DistributedCameraOgreListener::postComputeParameters(), sendEvent(), and sendValuedEvent().
Documentation generated on Mon Jun 9 11:46:04 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |