controller-state
Game controller input

Prev:read-mouse ( -- mouse-state )
Next:keyboard-state


Vocabulary
game.input

Class description
The read-controller word returns objects of this class. controller-state objects have the following slots:
• x contains the position of the device's X axis.
• y contains the position of the device's Y axis.
• z contains the position of the device's Z axis, if any.
• rx contains the rotational position of the device's X axis, if available.
• ry contains the rotational position of the device's Y axis, if available.
• rz contains the rotational position of the device's Z axis, if available.
• slider contains the position of the device's throttle slider, if any.
• pov contains the state of the device's POV hat, if any.
• buttons contains a sequence of values indicating the state of every button on the device.

The values are formatted as follows:
• For the axis slots (x, y, z, rx, ry, rz), a float value between -1.0 and 1.0 is returned.
• For the slider slot, a value between 0.0 and 1.0 is returned.
• For the pov slot, one of the following symbols is returned:
• pov-neutral
• pov-up
• pov-up-right
• pov-right
• pov-down-right
• pov-down
• pov-down-left
• pov-left
• pov-up-left
• For each element of the buttons array, f indicates that the corresponding button is released. If the button is pressed, a value between 0.0 and 1.0 is returned indicating the pressure on the button (or simply 1.0 if the device's buttons are on/off only).
• A value of f in any slot (besides the elements of buttons) indicates that the corresponding element is not present on the device.


See also
controller, read-controller

Definition

TUPLE: controller-state x y z rx ry rz slider pov buttons ;


Methods