sdlPlayHapticRumble function

bool sdlPlayHapticRumble(
  1. Pointer<SdlHaptic> haptic,
  2. double strength,
  3. int length
)

Run a simple rumble effect on a haptic device.

\param haptic the haptic device to play the rumble effect on. \param strength strength of the rumble to play as a 0-1 float value. \param length length of the rumble to play in milliseconds. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_InitHapticRumble \sa SDL_StopHapticRumble

extern SDL_DECLSPEC bool SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length)

Implementation

bool sdlPlayHapticRumble(
    Pointer<SdlHaptic> haptic, double strength, int length) {
  final sdlPlayHapticRumbleLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlHaptic> haptic, Float strength, Uint32 length),
      int Function(Pointer<SdlHaptic> haptic, double strength,
          int length)>('SDL_PlayHapticRumble');
  return sdlPlayHapticRumbleLookupFunction(haptic, strength, length) == 1;
}