Scroll to navigation

SDL_GetGamepadJoystick(3) SDL3 FUNCTIONS SDL_GetGamepadJoystick(3)

NAME

SDL_GetGamepadJoystick - Get the underlying joystick from a gamepad

SYNOPSIS

#include "SDL3/SDL.h"
SDL_Joystick* SDL_GetGamepadJoystick(SDL_Gamepad *gamepad);

DESCRIPTION

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

the gamepad object that you want to get a joystick from

RETURN VALUE

Returns an SDL_Joystick
object; call

SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.0.0.

SDL 3.1.0 SDL