SDL_OpenHapticFromJoystick(3)

SDL_OpenHapticFromJoystick3

Open a haptic device for use from a joystick device.

Usage

#include "SDL3/SDL.h"

SDL_Haptic * SDL_OpenHapticFromJoystick(SDL_Joystick *joystick);

Header file

Defined in SDL3/SDL_haptic.h

Overview

You must still close the haptic device separately. It will not be closed with the joystick.

When opened from a joystick you should first close the haptic device before closing the joystick device. If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.

Function parameters

joystick

the SDL_Joystick
to create a haptic device from.

Return value

( SDL_Haptic
*) Returns a valid haptic device identifier on success 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.