16 #ifndef SURGSIM_BLOCKS_KEYBEHAVIOR_H 17 #define SURGSIM_BLOCKS_KEYBEHAVIOR_H 45 void update(
double dt)
override;
46 bool doInitialize()
override;
47 bool doWakeUp()
override;
51 void setInputComponent(std::shared_ptr<Framework::Component> inputComponent);
55 std::shared_ptr<Input::InputComponent> getInputComponent()
const;
61 static bool registerKey(
int keycode,
const std::string& description);
66 static bool unregisterKey(
int keycode);
74 virtual void onKeyDown(
int key) = 0;
78 virtual void onKeyUp(
int key) = 0;
89 static std::unordered_map<int, std::string>
m_keyMap;
Definition: CompoundShapeToGraphics.cpp:29
static std::unordered_map< int, std::string > m_keyMap
Definition: KeyBehavior.h:89
int m_lastKey
Keep track if the key was pressed the last time around.
Definition: KeyBehavior.h:84
std::shared_ptr< Input::InputComponent > m_inputComponent
Input component needs to provide key.
Definition: KeyBehavior.h:81
Behaviors perform actions.
Definition: Behavior.h:40
Behavior to abstract the functionality of keyboard driven behaviors, can be programmed to react to a ...
Definition: KeyBehavior.h:36
static boost::mutex m_keyMapMutex
Definition: KeyBehavior.h:88