16 #ifndef SURGSIM_BLOCKS_KEYBOARDCALLBACKBEHAVIOR_H 17 #define SURGSIM_BLOCKS_KEYBOARDCALLBACKBEHAVIOR_H 33 SURGSIM_STATIC_REGISTRATION(KeyboardCallbackBehavior);
49 void setInputComponent(std::shared_ptr<Framework::Component> inputComponent);
53 std::shared_ptr<Input::InputComponent> getInputComponent()
const;
57 void registerKey(
int key);
62 void registerCallback(CallbackType func);
64 void update(
double dt)
override;
71 bool doInitialize()
override;
73 bool doWakeUp()
override;
92 #endif //SURGSIM_BLOCKS_KEYBOARDCALLBACKBEHAVIOR_H Definition: CompoundShapeToGraphics.cpp:29
int m_actionKey
The registered key, when pressed, the registered callback will be called.
Definition: KeyboardCallbackBehavior.h:80
CallbackType m_callback
Callback function.
Definition: KeyboardCallbackBehavior.h:83
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::shared_ptr< Input::InputComponent > m_inputComponent
Input component from which pressed key comes.
Definition: KeyboardCallbackBehavior.h:86
Behaviors perform actions.
Definition: Behavior.h:40
This behavior will call the registered callback function when the registered key is pressed...
Definition: KeyboardCallbackBehavior.h:36
std::function< void()> CallbackType
Definition: KeyboardCallbackBehavior.h:39
bool m_keyPressedLastUpdate
Record if any key is pressed in last update() call.
Definition: KeyboardCallbackBehavior.h:77