Function Get-Joystick-Pos
(
get-joystick-pos < joy > < numaxes > )
Parameters
joy
A joystick identifier, which should be GLFW_JOYSTICK_n, where n is in the range 1 to 16.
numaxes
Specifies how many axes should be returned.
Return values
An list that will hold the positional values for all requested axes.
If the joystick is not supported or connected, the function will
return nil.
Description
The function queries the current position of one or more axes of a joystick. The positional values are
returned in an array, where the first element represents the first axis of the joystick (normally the X
axis). Each position is in the range -1.0 to 1.0. Where applicable, the positive direction of an axis is
right, forward or up, and the negative direction is left, back or down.
If numaxes exceeds the number of axes supported by the joystick, or if the joystick is not available, the
unused elements in the pos array will be set to 0.0 (zero).
Notes
The joystick state is updated every time the function is called, so there is no need to call glfwPollEvents
or glfwWaitEvents for joystick state to be updated.
Use glfwGetJoystickParam to retrieve joystick capabilities, such as joystick availability and number of
supported axes.
No window has to be opened for joystick input to be valid.