16 #ifndef SURGSIM_BLOCKS_KEYBOARDTOGGLESCOMPONENTBEHAVIOR_H
17 #define SURGSIM_BLOCKS_KEYBOARDTOGGLESCOMPONENTBEHAVIOR_H
19 #include <unordered_map>
20 #include <unordered_set>
47 typedef std::unordered_map<int, std::unordered_set<std::shared_ptr<SurgSim::Framework::Component>>>
58 void setInputComponent(std::shared_ptr<SurgSim::Framework::Component> inputComponent);
80 virtual void update(
double dt)
override;
107 #endif //SURGSIM_BLOCKS_KEYBOARDTOGGLESCOMPONENTBEHAVIOR_H
Definition: DriveElementFromInputBehavior.cpp:27
std::shared_ptr< SurgSim::Input::InputComponent > m_inputComponent
Input component from which pressed keys come.
Definition: KeyboardTogglesComponentBehavior.h:98
void setKeyboardRegistry(const KeyboardRegistryType &map)
Set the register map of this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:97
std::shared_ptr< SurgSim::Input::InputComponent > getInputComponent() const
Get the input component of this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:49
void registerKey(SurgSim::Device::KeyCode key, std::shared_ptr< SurgSim::Framework::Component > component)
Register a key with a component in this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:54
std::unordered_map< int, std::unordered_set< std::shared_ptr< SurgSim::Framework::Component > > > KeyboardRegistryType
Definition: KeyboardTogglesComponentBehavior.h:48
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:43
KeyboardRegistryType m_registry
A mapping between key and the graphical representation(s) it controls.
Definition: KeyboardTogglesComponentBehavior.h:101
virtual void update(double dt) override
Update the behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:60
KeyCode
Definition: KeyCode.h:24
KeyboardTogglesComponentBehavior(const std::string &name)
Constructor.
Definition: KeyboardTogglesComponentBehavior.cpp:30
bool m_keyPressedLastUpdate
Record if any key is pressed in last update() call.
Definition: KeyboardTogglesComponentBehavior.h:95
This behavior is used to control the visibility of registered graphical representation(s) ...
Definition: KeyboardTogglesComponentBehavior.h:44
SURGSIM_CLASSNAME(SurgSim::Blocks::KeyboardTogglesComponentBehavior)
Behaviors perform actions.
Definition: Behavior.h:40
virtual bool doInitialize() override
Initialize this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:80
const KeyboardRegistryType & getKeyboardRegistry() const
Get the register map of this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:103
SURGSIM_STATIC_REGISTRATION(DriveElementFromInputBehavior)
void setInputComponent(std::shared_ptr< SurgSim::Framework::Component > inputComponent)
Set the input component from which pressed keys come.
Definition: KeyboardTogglesComponentBehavior.cpp:40
virtual bool doWakeUp() override
Wakeup this behavior.
Definition: KeyboardTogglesComponentBehavior.cpp:85