glfwGetGamepadState function
! @brief Retrieves the state of the specified joystick remapped as a gamepad.
This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
If the specified joystick is not present or does not have a gamepad mapping
this function will return GLFW_FALSE
but will not generate an error. Call
@ref glfwJoystickPresent to check whether it is present regardless of
whether it has a mapping.
The Guide button may not be available for input as it is often hooked by the system or the Steam client.
Not all devices have all the buttons or axes provided by @ref
GLFWgamepadstate. Unavailable buttons and axes will always report
GLFW_RELEASE
and 0.0 respectively.
@paramin
jid The joystick
(@ref joysticks) to query.
@paramout
state The gamepad input state of the joystick.
@return GLFW_TRUE
if successful, or GLFW_FALSE
if no joystick is
connected, it has no gamepad mapping or an error
(@ref error_handling)
occurred.
@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
@thread_safety This function must only be called from the main thread.
@sa @ref gamepad @sa @ref glfwUpdateGamepadMappings @sa @ref glfwJoystickIsGamepad
@since Added in version 3.3.
@ingroup input
GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
Implementation
int glfwGetGamepadState(int jid, Pointer<GLFWgamepadstate> state) {
final glfwGetGamepadStateLookupFunction = libglfw.lookupFunction<
Int32 Function(Int32 jid, Pointer<GLFWgamepadstate> state),
int Function(
int jid, Pointer<GLFWgamepadstate> state)>('glfwGetGamepadState');
return glfwGetGamepadStateLookupFunction(jid, state);
}