Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

ButtonSensor Class Reference

ButtonSensor listens for button events on the desired device (keyboard and mouse by default). More...

Inheritance diagram for ButtonSensor:

DeviceSensorNode ChildNode EventHandler Node Object List of all members.

Public Member Functions

virtual bool handleEvent (const Event &event)
 Callback function that is implemented by the callee.

Detailed Description

ButtonSensor listens for button events on the desired device (keyboard and mouse by default).

Authoring Interface:

        ButtonSensor {
                // from DeviceSensorNode
            field       SFBoolean   enabled             true
            field       SFURL       device              ""
       
            field       MFString    buttonOfInterest    [ ]
       
            eventOut    SFDouble    pressTime
            eventOut    SFDouble    releaseTime
            eventOut    SFString    string
        }

Parameters:
enabled controls whether this node will emit any events. Default value: true
device is a string identifying the device this sensor is listening to. Default value: ""
buttonOfInterest is a list of one or more buttons which will cause this node to fire its events. Each string can contain a single button or a range, specified as the first button, followed by '-', followed by the last button. A range can only be specified for any keyboard keys which have a natural ordering. "A-Z" specifies all upper case characters, "F1-F12" specifies all twelve function keys on a standard PC keyboard, and "UP" specifies the up-arrow key. The "SHIFT", "CONTROL" and "ALT" keys can also be specified. Note that if the ButtonSensor is sensitive to, for instance, "A", press events will be generated for SHIFT, then A, and then release events will be generated for both when they are released. A button may also be a number in hex, octal or decimal format. The button to which a given number corresponds is device dependent. For keyboards, the number is the unicode value of the key. Default value: [ ]
pressTime emits the event time when a buttonOfInterest is pressed.
releaseTime emits the event time when a buttonOfInterest is released.
string emits a string corresponding to the most recently pressed or released button. This event is generated before the corresponding pressTime or releaseTime. Therefore, to read keyboard keys, listen for pressTime and then read string.

Functionality:

...

The key string constants defined by default include:

"BACKSPACE"Backspace key
"TAB"Tab key
"CLEAR"Clear key
"RETURN"Return key
"PAUSE"Pause key
"ESCAPE"Escape key
"SPACE"Space bar
"DELETE"Delete key
"KP0"KeyPad 0 key
"KP1"KeyPad 1 key
"KP2"KeyPad 2 key
"KP3"KeyPad 3 key
"KP4"KeyPad 4 key
"KP5"KeyPad 5 key
"KP6"KeyPad 6 key
"KP7"KeyPad 7 key
"KP8"KeyPad 8 key
"KP9"KeyPad 9 key
"KP_PERIOD"KeyPad Period key
"KP_DIVIDE"KeyPad Divide key
"KP_MULTIPLY"KeyPad Multiply key
"KP_MINUS"KeyPad Minus key
"KP_PLUS"KeyPad Plus key
"KP_ENTER"KeyPad Enter key
"KP_EQUALS"KeyPad Equals key
"UP"Up Arrow key
"DOWN"Down Arrow key
"RIGHT"Right Arrow key
"LEFT"Left Arrow key
"INSERT"Insert key
"HOME"Home key
"END"End key
"PAGEUP"Page Up key
"PAGEDOWN"Page Down key
"F1"F1 function key
"F2"F2 function key
"F3"F3 function key
"F4"F4 function key
"F5"F5 function key
"F6"F6 function key
"F7"F7 function key
"F8"F8 function key
"F9"F9 function key
"F10"F10 function key
"F11"F11 function key
"F12"F12 function key
"F13"F13 function key
"F14"F14 function key
"F15"F15 function key
"NUMLOCK"Num Lock key
"CAPSLOCK"Caps Lock key
"SCROLLOCK"Scroll Lock key
"RSHIFT"Right Shift key
"LSHIFT"Left Shift key
"RCTRL"Right Ctrl key
"LCTRL"Left Ctrl key
"RALT"Right Alt key
"LALT"Left Alt key
"RMETA"Right Meta key
"LMETA"Left Meta key
"LSUPER"Left "Windows" key
"RSUPER"Right "Windows" key
"MODE""Alt Gr" key
"COMPOSE"Multi-key compose key
"HELP"Help key
"PRINT"Print key
"SYSREQ"SysReq key
"BREAK"Break key
"MENU"Menu key
"POWER"Power Macintosh Power key
"EURO"Euro key on European keyboards
"UNDO"Undo key on the Atari keyboard
"MOUSELBUTTON"Left mouse button
"MOUSEMBUTTON"Middle mouse button
"MOUSERBUTTON"Right mouse button


Member Function Documentation

virtual bool handleEvent const Event event  )  [virtual]
 

Callback function that is implemented by the callee.

Parameters:
event specifies the time of the event. Event time will be the same for events occurring in the same render phase For example, PREUPDATE, POSTUPDATE, PRERENDER and POSTRENDER event callbacks will all pass the same event time for the same frame. Returning stop Emma from calling the rest of the handlers for this event If you return true, Emma will keep on calling rest of the handlers for this event

Reimplemented from DeviceSensorNode.


Generated on Sat Apr 1 06:08:08 2006 for Emma Content Development Kit by  doxygen 1.4.3