sdlOpenHaptic function

Pointer<SdlHaptic> sdlOpenHaptic(
  1. int instanceId
)

Open a haptic device for use.

The index passed as an argument refers to the N'th haptic device on this system.

When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use SDL_SetHapticGain() and SDL_SetHapticAutocenter().

\param instance_id the haptic device instance ID. \returns the device identifier or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_CloseHaptic \sa SDL_GetHaptics \sa SDL_OpenHapticFromJoystick \sa SDL_OpenHapticFromMouse \sa SDL_SetHapticAutocenter \sa SDL_SetHapticGain

extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_OpenHaptic(SDL_HapticID instance_id)

Implementation

Pointer<SdlHaptic> sdlOpenHaptic(int instanceId) {
  final sdlOpenHapticLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlHaptic> Function(Uint32 instanceId),
      Pointer<SdlHaptic> Function(int instanceId)>('SDL_OpenHaptic');
  return sdlOpenHapticLookupFunction(instanceId);
}