Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2010-09-03 03:32:43
Size: 4000
Editor: SheenaSmith
Comment: update formatting - categories
Revision 3 as of 2011-12-13 01:36:22
Size: 3904
Editor: SheenaSmith
Comment: some sans-Sam editing (shift green to comment); camelcase
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
#pragma disable-camelcase #pragma camelcase off
Line 11: Line 11:
||Uint16||'''type'''||effect type|| ||Uint16||'''type'''||effect type; see [[SDL_HapticPeriodic]] for details???||
Line 24: Line 24:
^All structs in this union contain the following^ common parts: All structures in this union contain the following common parts:
Line 38: Line 38:
All values max at 32767 (0x7FFF). Signed values ,,also,, can be negative. Time values, unless specified otherwise, are in milliseconds. All values max at 32767 (0x7FFF). Signed values can be negative. Time values, unless specified otherwise, are in milliseconds.
Line 40: Line 40:
You can ,,also,, pass SDL_HAPTIC_INFINITY to '''length''' instead of a 0-32767 value. Neither '''delay''', '''interval''', '''attack_length''' nor '''fade_length''' support SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.  <<Color2(green,That last sentence about Fade is awkward and potentially confusing for a novice user.  How could it be rewritten to be more clear?)>> 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. Fade will also not be used since effect never ends.
The SDL_HAPTI
C_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY.
Line 42: Line 43:
,,Additionally, ,,the SDL_HAPTIC_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY. <<Color2(green,Should this sentence be joined to the paragraph above?)>> /* The last sentence from line 698 version f3c34d321289 SDL_haptic.h is awkward and potentially confusing. How could it be revised to make it more clear? */
Line 44: Line 45:
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,,y,, joystick. <<Color2(green,Does this mean that the joystick itself is index 0 and the buttons are index >=1?)>> 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.
/*
Does this mean that the joystick itself is index 0 and the buttons are index >=1? */
Line 46: Line 48:
If both '''attack_length''' and '''fade_level''' are 0, the '''envelope''' is not used, otherwise both values are used. If both '''attack_length''' and '''fade_level''' are 0 the '''envelope''' is not used, otherwise both values are used.
Line 48: Line 50:
Here ,,we have,, ^is^ an example of a constant effect evolution in time: Here is an example of a constant effect evolution in time:
Line 70: Line 72:
Note ^that^ either the '''attack_level''' or the '''fade_level''' may be above the actual effect level. Note that either the '''attack_level''' or the '''fade_level''' may be above the actual effect level.
Line 72: Line 74:
<<Color2(green,Note that some minor edits to the verbatim text in the header have been made and not noted above.)>> /* Note that some minor edits to the verbatim text in the header have been made and not noted above. */
Line 78: Line 80:
 .[[SDL_HapticDirection]] ??? (from header but not referenced in the union)  .[[SDL_HapticDirection]] ??? /* (from header but not referenced in the union) */

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???

SDL_HapticConstant

constant

constant effect; see Remarks for details

SDL_HapticPeriodic

periodic

periodic effect; see Remarks for details

SDL_HapticCondition

condition

condition effect; see Remarks for details

SDL_HapticRamp

ramp

ramp effect; see Remarks for details

SDL_HapticCustom

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. Fade will also not be used since effect never ends. 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 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                 length

Note that either the attack_level or the fade_level may be above the actual effect level.


CategoryStruct, CategoryForceFeedback

None: SDL_HapticEffect (last edited 2018-04-05 07:34:42 by RainerDeyke)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit