SDL_GetGamepadJoystick(3)

SDL_GetGamepadJoystick3

Get the underlying joystick from a gamepad.

Usage

#include "SDL3/SDL.h"

SDL_Joystick * SDL_GetGamepadJoystick(SDL_Gamepad *gamepad);

Header file

Defined in SDL3/SDL_gamepad.h

Overview

This function will give you a SDL_Joystick
object, which allows you to use the SDL_Joystick
functions with a

SDL_Gamepad
object. This would be useful for getting a joystick's position at any given time, even if it hasn't moved (moving it would produce an event, which would have the axis' value).

The pointer returned is owned by the SDL_Gamepad . You should not call SDL_CloseJoystick () on it, for example, since doing so will likely cause SDL to crash.

Function parameters

gamepad

the gamepad object that you want to get a joystick from.

Return value

( SDL_Joystick
*) Returns an SDL_Joystick

object, or NULL on failure; call SDL_GetError () for more information.

Availability

This function is available since SDL 3.2.0.

From libsdl3-doc 3.2.10+ds-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.