sdlUpdateHapticEffect function haptic

bool sdlUpdateHapticEffect(
  1. Pointer<SdlHaptic> haptic,
  2. int effect,
  3. Pointer<SdlHapticEffect> data
)

Update the properties of an effect.

Can be used dynamically, although behavior when dynamically changing direction may be strange. Specifically the effect may re-upload itself and start playing from the start. You also cannot change the type either when running SDL_UpdateHapticEffect().

\param haptic the SDL_Haptic device that has the effect. \param effect the identifier of the effect to update. \param data an SDL_HapticEffect structure containing the new effect properties to use. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.2.0.

\sa SDL_CreateHapticEffect \sa SDL_RunHapticEffect

extern SDL_DECLSPEC bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, SDL_HapticEffectID effect, const SDL_HapticEffect *data)

Implementation

bool sdlUpdateHapticEffect(
  Pointer<SdlHaptic> haptic,
  int effect,
  Pointer<SdlHapticEffect> data,
) {
  final sdlUpdateHapticEffectLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlHaptic> haptic,
          Int32 effect,
          Pointer<SdlHapticEffect> data,
        ),
        int Function(
          Pointer<SdlHaptic> haptic,
          int effect,
          Pointer<SdlHapticEffect> data,
        )
      >('SDL_UpdateHapticEffect');
  return sdlUpdateHapticEffectLookupFunction(haptic, effect, data) == 1;
}