H3D API  2.4.1
KeySensor.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __X3DKEYSENSOR_H__
30 #define __X3DKEYSENSOR_H__
31 
32 
34 #include <H3D/SFInt32.h>
35 #include <H3D/SFString.h>
36 
37 namespace H3D {
38 
91  class H3DAPI_API KeySensor : public X3DKeyDeviceSensorNode {
92  public:
93 
95  KeySensor( Inst< SFBool> _enabled = 0,
96  Inst< SFNode> _metadata = 0,
97  Inst< SFBool> _isActive = 0,
98  Inst< SFInt32> _actionKeyPress = 0,
99  Inst< SFInt32> _actionKeyRelease = 0,
100  Inst< SFBool> _altKey = 0,
101  Inst< SFBool> _controlKey = 0,
102  Inst< SFBool> _shiftKey = 0,
103  Inst< SFString> _keyPress = 0,
104  Inst< SFString> _keyRelease = 0
105  );
106 
108  virtual void keyboardDown( int key, bool special_key );
109 
111  virtual void keyboardUp( int key, bool special_key );
112 
119  H3DUniquePtr< SFInt32> actionKeyPress;
120 
127  H3DUniquePtr< SFInt32> actionKeyRelease;
128 
135  H3DUniquePtr< SFBool> altKey;
136 
143  H3DUniquePtr< SFBool> controlKey;
144 
151  H3DUniquePtr< SFBool> shiftKey;
152 
159  H3DUniquePtr< SFString> keyPress;
160 
167  H3DUniquePtr< SFString> keyRelease;
168 
171  };
172 }
173 
174 #endif
Contains the SFInt32 field class.
Contains the SFString field class.
Header file for X3DKeyDeviceSensorNode, X3D scene-graph node.
A KeySensor node generates events when the user presses keys on the keyboard.
Definition: KeySensor.h:91
H3DUniquePtr< SFString > keyPress
The keyPress field events are generated as keys which produce characters are pressed.
Definition: KeySensor.h:159
H3DUniquePtr< SFString > keyRelease
The keyRelease field events are generated as keys which produce characters are released.
Definition: KeySensor.h:167
H3DUniquePtr< SFBool > controlKey
Generates events when control key is used.
Definition: KeySensor.h:143
H3DUniquePtr< SFBool > altKey
Generates events when alt key is used.
Definition: KeySensor.h:135
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: KeySensor.h:170
H3DUniquePtr< SFInt32 > actionKeyPress
The actionKeyPress fields contains an integer that specifies which action key was the last one to be ...
Definition: KeySensor.h:119
H3DUniquePtr< SFBool > shiftKey
Generates events when shift key is used.
Definition: KeySensor.h:151
H3DUniquePtr< SFInt32 > actionKeyRelease
The actionKeyRelease fields contains an integer that specifies which action key was the last one to b...
Definition: KeySensor.h:127
This abstract node type is the base type for all sensor node types which operate using key devices.
Definition: X3DKeyDeviceSensorNode.h:43
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194