opensurgsim
SingleKeyBehavior.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2016, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_BLOCKS_SINGLEKEYBEHAVIOR_H
17 #define SURGSIM_BLOCKS_SINGLEKEYBEHAVIOR_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/Blocks/KeyBehavior.h"
23 
24 namespace SurgSim
25 {
26 namespace Input
27 {
28 class InputComponent;
29 }
30 
31 namespace Blocks
32 {
33 
37 {
38 public:
40  explicit SingleKeyBehavior(const std::string& name);
41 
44 
45  bool doWakeUp() override;
46 
49  void setKey(int val);
50 
52  int getKey() const;
53 
54 protected:
55  void setDescription(const std::string& description);
56 
57  virtual void onKey() = 0;
58 
59  void onKeyDown(int actualKey) override;
60 
61  void onKeyUp(int actualKey) override;
62 
63  std::shared_ptr<Input::InputComponent> m_inputComponent;
64 
67 
68  std::string m_description;
69 };
70 
71 }; // namespace Blocks
72 }; // namespace SurgSim
73 
74 #endif // SURGSIM_BLOCKS_SINGLEKEYBEHAVIOR_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
int m_actionKey
Registered key to trigger action.
Definition: SingleKeyBehavior.h:66
Behavior to abstract the functionality of keyboard driven behaviors, can be programmed to react to a ...
Definition: SingleKeyBehavior.h:36
Behavior to abstract the functionality of keyboard driven behaviors, can be programmed to react to a ...
Definition: KeyBehavior.h:36