Function Get-Joystick-Buttons

Part of:

package glfw
( get-joystick-buttons < joy > < numbuttons > )
Parameters
joy
A joystick identifier, which should be GLFW_JOYSTICK_n, where n is in the range 1 to 16.
numbuttons
Specifies how many buttons should be returned.
Return values
A list that will hold the button states for all requested buttons.
The function returns the number of actually returned buttons. This is the minimum of numbuttons and
the number of buttons supported by the joystick. If the joystick is not supported or connected, the
function will return 0 (zero).

Description
The function queries the current state of one or more buttons of a joystick. The button states are
returned in an array, where the first element represents the first button of the joystick. Each state can be
either GLFW_PRESS or GLFW_RELEASE.
If numbuttons exceeds the number of buttons supported by the joystick, or if the joystick is not
available, the unused elements in the buttons array will be set to GLFW_RELEASE.

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 buttons.
No window has to be opened for joystick input to be valid.