H3D::KeySensor Class Reference
[X3D node classes.]

A KeySensor node generates events when the user presses keys on the keyboard. More...

#include <H3D/KeySensor.h>

Inheritance diagram for H3D::KeySensor:

Inheritance graph

List of all members.

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 keyboardDown (int key, bool special_key)
 Function called when key is pressed.
virtual void keyboardUp (int key, bool special_key)
 Function called when key is released.

Public Attributes

auto_ptr< SFInt32actionKeyPress
 The actionKeyPress fields contains an integer that specifies which action key was the last one to be pressed.
auto_ptr< SFInt32actionKeyRelease
 The actionKeyRelease fields contains an integer that specifies which action key was the last one to be released.
auto_ptr< SFBoolaltKey
 The altKey field is not supported at this time by H3DAPI.
auto_ptr< SFBoolcontrolKey
 The controlKey field is not supported at this time by H3DAPI.
auto_ptr< SFBoolshiftKey
 The shiftKey field is not supported at this time by H3DAPI.
auto_ptr< SFStringkeyPress
 The keyPress field events are generated as keys which produce characters are pressed.
auto_ptr< SFStringkeyRelease
 The keyRelease field events are generated as keys which produce characters are released.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.


Detailed Description

A KeySensor node generates events when the user presses keys on the keyboard.

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-F121-12
HOME13
END14
PGUP15
PGDN16
UP17
DOWN18
LEFT19
RIGHT20

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.


Member Data Documentation

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

Referenced by keyboardDown().

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

Referenced by keyboardUp().

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

Referenced by keyboardDown().

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

Referenced by keyboardUp().


The documentation for this class was generated from the following files:

Generated on Fri Nov 7 10:30:31 2008 for H3D API by  doxygen 1.5.7