glfwGetGamepadState

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.

extern (C) @nogc nothrow __gshared
int
glfwGetGamepadState

Parameters

jid int

The joystick to query.

state GLFWgamepadstate*

The gamepad input state of the joystick.

Return Value

Type: int

GLFW_TRUE if successful, or GLFW_FALSE if no joystick is connected, it has no gamepad mapping or an error 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

Meta

Since

Added in version 3.3.

Ingroup: input