sdlxUpdateHapticEffect function haptic

bool sdlxUpdateHapticEffect(
  1. Pointer<SdlHaptic> haptic,
  2. int effect,
  3. SdlxHapticEffect 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 sdlxUpdateHapticEffect(
  Pointer<SdlHaptic> haptic,
  int effect,
  SdlxHapticEffect data,
) {
  final dataPointer = data.calloc();
  final result = sdlUpdateHapticEffect(haptic, effect, dataPointer);
  dataPointer.callocFree();
  return result;
}