#X3D V3.0

Group {
 children [
  Group {
   children [
    Group {
     children [
      WorldInfo {
       info ["This shows usage of X3D KeySensor" "and triggering of events" "" "GPAC Regression Tests" "$Date: 2007-07-27 11:30:48 $ - $Revision: 1.2 $" "(C) 2002-2003 ENST"]
       title "KeySensor X3D Test"
      }
      Shape {
       appearance Appearance {
        material Material {
         diffuseColor 1 1 1
        }
       }
       geometry DEF TEXT Text {
        string ["Hit any key", ""]
        fontStyle FontStyle {
         justify ["MIDDLE" "MIDDLE"]
        }
       }
      }
      DEF SC Script {
       inputOnly SFString keyUp
       inputOnly SFString keyDown
       inputOnly SFInt32 sysKeyUp
       inputOnly SFInt32 sysKeyDown
       inputOnly SFBool altKey
       inputOnly SFBool ctrlKey
       inputOnly SFBool shiftKey
       initializeOnly SFNode txt USE TEXT
       url ["javascript:
        function keyUp(value) {
         txt.string[0] = 'Key up: ' + value;
        }
        function keyDown(value) {
         txt.string[0] = 'Key down: ' + value;
        }     
        function sysKeyUp(value) {
         txt.string[0] = 'System Key up: ' + value;
        }
        function sysKeyDown(value) {
         txt.string[0] = 'System Key down: ' + value;
        }     
        function altKey(value) {
         txt.string[1] = value ? 'ALT key pressed' : '';
        }     
        function shiftKey(value) {
         txt.string[1] = value ? 'SHIFT key pressed' : '';
        }     
        function ctrlKey(value) {
         txt.string[1] = value ? 'CTRL key pressed' : '';
        }     
       "
       ]
      }
      DEF KS KeySensor {}
     ]
    }
   ]
  }
 ]
}
ROUTE KS.keyPress TO SC.keyDown
ROUTE KS.keyRelease TO SC.keyUp
ROUTE KS.actionKeyPress TO SC.sysKeyDown
ROUTE KS.actionKeyRelease TO SC.sysKeyUp
ROUTE KS.altKey TO SC.altKey
ROUTE KS.controlKey TO SC.ctrlKey
ROUTE KS.shiftKey TO SC.shiftKey
