nInputServer Script Interface
ninputserver:
Super Class:
C++ Class:
Info
The inputserver lives under /sys/servers/input and provides the global list of input events for you. The server does not in any case generate the input events by itself. The nGfxServer for example feeds the inputserver with key and mouse events. The inputsever has to be created after the gfxserver, because the gfxserver provides a windows handle which is needed by the inputserver(at least under win32 for direct input). In /sys/share/input you can lookup which input devices the server has recognized and which channels a device provides.Commands:
- startlogging
- stoplogging
- islogging
- beginmap
- map
- endmap
- getslider
- getbutton
- setlongpressedtime
- getlongpressedtime
- setdoubleclicktime
- getdoubleclicktime
- setmousefactor
- getmousefactor
- setmouseinvert
- getmouseinvert
- getmousepos
startlogging
- Command Input:
v
- Command Output:
v
- Command Description:
- Starts input logging to stdout.
stoplogging
- Command Input:
v
- Command Output:
v
- Command Description:
- Stops input logging.
islogging
- Command Input:
v
- Command Output:
b (Logging)
- Command Description:
- Returns the logging status.
beginmap
- Command Input:
v
- Command Output:
v
- Command Description:
- Starts a block of mapping definitions. All earlier defined mappings are lost!
map
- Command Input:
s (EventName), s (StateName)
- Command Output:
b (Success)
- Command Description:
- Maps a input event to a input state. The 'EventName' defines an input event which controls the via 'StateName' given input state. The definition of a input event consists of a device ID, channel ID and channel modifier (not on axes): dev:channel[.up|down|pressed|long|double]
- keyb0:b.pressed - Key 'B' on Keyboard 0 pressed
- keyb0:a.down - Key 'A' on Keyboard 0 pressed down
- joy0:b0.up - Button 0 on Joystick 0 released
- joy1:b1.double - Button 1 on Joystick 1 doubble clicked
- joy0:b2.long - Button 2 on Joystick 2 pressed very long
- mouse0:-x - Mouse 0 moved to the left
A list of the accepted devices can be found under '/sys/share/input/devs', the list of the channels provided by the device can be found in the 'channels' subdirectory of each device.
The list of the actual states is under '/sys/share/input/states'. Some examples for a complete mapping:
- .map joy0:-x move_left
- .map joy0:+x move_right
- .map joy0:-y move_down
- .map joy0:+y move_up
- .map keyb0:f1.down "script:incr x"
- .map keyb0:f2.down "script:newv sammler"
endmap
- Command Input:
v
- Command Output:
v
- Command Description:
- Closes a block of mapping definitions.
getslider
- Command Input:
s (InputState)
- Command Output:
f (Value)
- Command Description:
- Returns the state of the input state as an analog slider value.
getbutton
- Command Input:
s (InputState)
- Command Output:
b (ButtonPressed)
- Command Description:
- Returns the state of the input state as a button Depending on the input mapping the routine returns true if:
- the button is pressed(.pressed)
- the button is down(.down)
- the button is released(.up)
- the button is pressed for a longer time(.long)
- the button is double clicked(.double)
setlongpressedtime
- Command Input:
f (LongPressedTime)
- Command Output:
v
- Command Description:
- Sets the time it takes to trigger a long pressed event of an input mapping.
getlongpressedtime
- Command Input:
v
- Command Output:
f (LongPressedTime)
- Command Description:
- Returns the via 'setlongpressedtime' set value.
setdoubleclicktime
- Command Input:
f (DoubleClickTime)
- Command Output:
v
- Command Description:
- Sets the time interval for a double click event.
getdoubleclicktime
- Command Input:
v
- Command Output:
f (DoubleClickTime)
- Command Description:
- Returns the time interval of the double click event, set via 'setdoubleclicktime'.
setmousefactor
- Command Input:
f (MouseFactor)
- Command Output:
v
- Command Description:
- Set the mouse input factor.
getmousefactor
- Command Input:
v
- Command Output:
f (MouseFactor)
- Command Description:
- Get the mouse input factor.
setmouseinvert
- Command Input:
b (MouseInvert)
- Command Output:
v
- Command Description:
- Set the mouse invert flag.
getmouseinvert
- Command Input:
v
- Command Output:
b (MouseInvert)
- Command Description:
- Get the mouse invert flag.
getmousepos
- Command Input:
v
- Command Output:
ff (x,y coords)
- Command Description:
- Get the current mouse position. (0,0) is the upper left hand corner, (1,1) is the lower right.