THIS PAGE IS A WORK IN PROGRESS ... Please make edits to this page to improve it!
The generic template for any haptic effect.
Defined in [SDL_haptic.h](https://github.com/libsdl-org/SDL/blob/SDL2/include/SDL_haptic.h)
typedef union SDL_HapticEffect
{/* Common for all force feedback effects */
/**< Effect type. */
Uint16 type; /**< Constant effect. */
SDL_HapticConstant constant; /**< Periodic effect. */
SDL_HapticPeriodic periodic; /**< Condition effect. */
SDL_HapticCondition condition; /**< Ramp effect. */
SDL_HapticRamp ramp; /**< Left/Right effect. */
SDL_HapticLeftRight leftright; /**< Custom effect. */
SDL_HapticCustom custom; } SDL_HapticEffect;
All values max at 32767 (0x7FFF). Signed values also can be negative. Time values unless specified otherwise are in milliseconds.
You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. Neither delay, interval, attack_length nor fade_length support
ends.
Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of ::SDL_HAPTIC_INFINITY.
Button triggers may not be supported on all devices, it is advised to not use them if possible. Buttons start at index 1 instead of index 0 like the joystick.
If both attack_length and fade_level are 0, the envelope is not used, otherwise both values are used.
Common parts:
Uint16 |
type |
effect type; see SDL_HapticPeriodic for details |
constant |
constant effect; see Remarks for details |
|
periodic |
periodic effect; see Remarks for details |
|
condition |
condition effect; see Remarks for details |
|
ramp |
ramp effect; see Remarks for details |
|
leftright |
left/right effect; see Remarks for details |
|
custom |
custom effect; see Remarks for details |
CategoryAPI, CategoryAPIStruct, CategoryStruct, CategoryForceFeedback, CategoryDraft