TSdlHapticEffect
The generic template for any haptic effect.
All values max at 32767 ($7FFF). 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, AttackLength nor FadeLength support SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
Additionally, the TSdlHapticKind.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 AttackLength and FadeLevel are 0, the envelope is not used, otherwise both values are used.
Common parts:
// Replay - All effects have this
Length: Cardinal; // Duration of effect (ms).
Delay: Word; // Delay before starting effect.
// Trigger - All effects have this
Button: Word; // Button that triggers effect.
Interval: Word; // How soon before effect can be triggered again.
// Envelope - All effects except condition effects have this
AttackLength: Word; // Duration of the attack (ms).
AttackLevel: Word; // Level at the start of the attack.
FadeLength: Word; // Duration of the fade out (ms).
FadeLevel: Word; // Level at the end of the fade.
Here we have an example of a constant effect evolution in time:
Strength
^
|
| effect level --> _________________
| / \
| / \
| / \
| / \
| attack_level --> | \
| | | ˂--- fade_level
|
+--------------------------------------------------> Time
[--] [---]
attack_length fade_length
[------------------][-----------------------]
delay length
Note either the attack_level or the fade_level may be above the actual effect level.
Definition
Unit: Neslib.Sdl3.Haptic
See Also
- TSdlHapticConstant
- TSdlHapticPeriodic
- TSdlHapticCondition
- TSdlHapticRamp
- TSdlHapticLeftRight
- TSdlHapticCustom
Fields
Name | Description |
---|---|
Condition | Condition effect. |
Constant | Constant effect. |
Custom | Custom effect. |
Kind | Effect type, shared with all effects. |
LeftRight | Left/Right effect. |
Periodic | Periodic effect. |
Ramp | Ramp effect. |
Field Descriptions
Condition
Condition effect.
var Condition: TSdlHapticCondition
Type: TSdlHapticCondition
Constant
Constant effect.
var Constant: TSdlHapticConstant
Type: TSdlHapticConstant
Custom
Custom effect.
var Custom: TSdlHapticCustom
Type: TSdlHapticCustom
Kind
Effect type, shared with all effects.
var Kind: TSdlHapticKind
Type: TSdlHapticKind
LeftRight
Left/Right effect.
var LeftRight: TSdlHapticLeftRight
Type: TSdlHapticLeftRight
Periodic
Periodic effect.
var Periodic: TSdlHapticPeriodic
Type: TSdlHapticPeriodic
Ramp
Ramp effect.
var Ramp: TSdlHapticRamp
Type: TSdlHapticRamp