|
Size: 4088
Comment: Removed comment and an unrelated structure because it is linked on other pages.
|
Size: 4079
Comment: Removed ???.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 11: | Line 11: |
| ||Uint16||'''type'''||effect type; see [[SDL_HapticPeriodic]] for details???|| | ||Uint16||'''type'''||effect type; see [[SDL_HapticPeriodic]] for details|| |
| Line 42: | Line 42: |
| The SDL_HAPTIC_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY. | The SDL_HAPTIC_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY. |
| Line 45: | Line 45: |
| /* Ramp sentence combined into this paragraph, separate in header. The last sentence about Fade (from line 698 version f3c34d321289 SDL_haptic.h) is awkward and potentially confusing. How could it be revised to make it more clear? */ | /* Ramp sentence combined into this paragraph, separate in header. The last sentence about Fade (from line 698 version f3c34d321289 SDL_haptic.h) is awkward and potentially confusing. How could it be revised to make it more clear? */ |
| Line 47: | Line 47: |
| Button triggers may not be supported on all devices. It is advised not to use them if possible. Buttons start at index 1 instead of index 0 like the joystick. | Button triggers may not be supported on all devices. It is advised not to use them if possible. Buttons start at index 1 instead of index 0 like the joystick. |
| Line 61: | Line 61: |
| | / \ | | / \ |
DRAFT |
SDL_HapticEffect
A union that contains the generic template for any haptic effect.
Data Fields
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 |
Code Examples
You can add your code example here
Remarks
All structures in this union contain the following common parts:
Replay (all effects have this) |
||
Uint32 |
length |
duration of effect (ms) |
Uint16 |
delay |
delay before starting effect |
Trigger (all effects have this) |
||
Uint16 |
button |
button that triggers effect |
Uint16 |
interval |
how soon before effect can be triggered again |
Envelope (all effects except condition effects have this) |
||
Uint16 |
attack_length |
duration of the attack (ms) |
Uint16 |
attack_level |
level at the start of the attack |
Uint16 |
fade_length |
duration of the fade out (ms) |
Uint16 |
fade_level |
level at the end of the fade |
All values max at 32767 (0x7FFF). Signed values can be negative. Time values, unless specified otherwise, are in milliseconds.
You can pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. Neither delay, interval, attack_length, nor fade_length support SDL_HAPTIC_INFINITY. The SDL_HAPTIC_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
Button triggers may not be supported on all devices. It is advised not to 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.
Here is an example of a constant effect evolution in time:
Strength
^
|
| effect level --> _________________
| / \
| / \
| / \
| / \
| attack_level --> | \
| | | <--- fade_level
|
+--------------------------------------------------> Time
[--] [---]
attack_length fade_length
[------------------][-----------------------]
delay lengthNote that either the attack_level or the fade_level may be above the actual effect level.
Related Structures
