#include <KeySensor.h>
Inheritance diagram for H3D::KeySensor:

Public Types | |
| enum | ActionKeys { F1 = 1, F2 = 2, F3 = 3, F4 = 4, F5 = 5, F6 = 6, F7 = 7, F8 = 8, F9 = 9, F10 = 10, F11 = 11, F12 = 12, HOME = 13, END = 14, PGUP = 15, PGDN = 16, UP = 17, DOWN = 18, LEFT = 19, RIGHT = 20 } |
Public Member Functions | |
| KeySensor (Inst< SFBool > _enabled=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isActive=0, Inst< SFInt32 > _actionKeyPress=0, Inst< SFInt32 > _actionKeyRelease=0, Inst< SFBool > _altKey=0, Inst< SFBool > _controlKey=0, Inst< SFBool > _shiftKey=0, Inst< SFString > _keyPress=0, Inst< SFString > _keyRelease=0) | |
| Constructor. | |
| virtual void | glutKeyboardUp (int stroke, int modifiers, bool special_key) |
| Function called when key is released. | |
| virtual void | glutKeyboardDown (int stroke, int modifiers, bool special_key) |
| Function called when key is released. | |
Public Attributes | |
| auto_ptr< SFInt32 > | actionKeyPress |
| The actionKeyPress fields contains an integer that specifies which action key was the last one to be pressed. | |
| auto_ptr< SFInt32 > | actionKeyRelease |
| The actionKeyRelease fields contains an integer that specifies which action key was the last one to be released. | |
| auto_ptr< SFBool > | altKey |
| The altKey field is not supported at this time by H3DAPI. | |
| auto_ptr< SFBool > | controlKey |
| The controlKey field is not supported at this time by H3DAPI. | |
| auto_ptr< SFBool > | shiftKey |
| The shiftKey field is not supported at this time by H3DAPI. | |
| auto_ptr< SFString > | keyPress |
| The keyPress field events are generated as keys which produce characters are pressed. | |
| auto_ptr< SFString > | keyRelease |
| The keyRelease field events are generated as keys which produce characters are released. | |
Static Public Attributes | |
| static H3DNodeDatabase | database |
| The H3DNodeDatabase for this node. | |
A KeySensor node can be enabled or disabled by sending it an enabled event with a value of TRUE or FALSE. If the KeySensor node is disabled, it does not track keyboard input or send events.
keyPress and keyRelease events are generated as keys which produce characters are pressed and released on the keyboard. The value of these events is a string of length 1 containing the single UTF-8 character associated with the key pressed. The set of UTF-8 characters that can be generated will vary between different keyboards and different implementations.
actionKeyPress and actionKeyRelease events are generated as 'action' keys are pressed and released on the keyboard. The value of these events are:
| F1-F12 | 1-12 |
| HOME | 13 |
| END | 14 |
| PGUP | 15 |
| PGDN | 16 |
| UP | 17 |
| DOWN | 18 |
| LEFT | 19 |
| RIGHT | 20 |
The following is unimplemented in H3DAPI since it is not supported by glut to get an event when a shift, control or alt key is pressed. shiftKey, controlKey, and altKey events are generated as the shift, alt and control keys on the keyboard are pressed and released. Their value is TRUE when the key is pressed and FALSE when the key is released.
When a key is pressed, the KeySensor sends an isActive event with value TRUE. Once the key is released, the KeySensor sends an isActive event with value FALSE.
The KeySensor is not affected by its position in the transformation hierarchy.
|
|
The actionKeyPress fields contains an integer that specifies which action key was the last one to be pressed. Info on the values can be found in the detailed description. Access type: outputOnly |
|
|
The actionKeyRelease fields contains an integer that specifies which action key was the last one to be released. Info on the values can be found in the detailed description. Access type: outputOnly |
|
|
The keyPress field events are generated as keys which produce characters are pressed. The field contains a string of length 1 with the single UTF-8 character associated with the latest key that was pressed. Access type: outputOnly |
|
|
The keyRelease field events are generated as keys which produce characters are released. The field contains a string of length 1 with the single UTF-8 character associated with the latest key that was released. Access type: outputOnly |
1.4.5