Class SDL_HapticEffect
- java.lang.Object
-
- com.sun.jna.Structure
-
- com.sun.jna.Union
-
- io.github.libsdl4j.api.haptic.SDL_HapticEffect
-
public final class SDL_HapticEffect extends com.sun.jna.Union
The generic template for any haptic effect.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, attackLength nor fadeLength supportSDL_HAPTIC_INFINITY
. Fade will also not be used since effect never ends.Additionally, the
SDL_HAPTIC_RAMP
effect does not support a duration ofSDL_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 int length; // Duration of effect (ms). short delay; // Delay before starting effect. // Trigger - All effects have this short button; // Button that triggers effect. short interval; // How soon before effect can be triggered again. // Envelope - All effects except condition effects have this short attackLength; // Duration of the attack (ms). short attackLevel; // Level at the start of the attack. short fadeLength; // Duration of the fade out (ms). short fadeLevel; // Level at the end of the fade.
Here we have an example of a constant effect evolution in time:Strength ^ | | effect level --> _________________ | / \ | / \ | / \ | / \ | attackLevel --> | \ | | | <--- fadeLevel | +--------------------------------------------------> Time [--] [---] attackLength fadeLength [------------------][-----------------------] delay length
Note either the attackLevel or the fadeLevel may be above the actual effect level.
-
-
Field Summary
Fields Modifier and Type Field Description SDL_HapticCondition
condition
Condition effect.SDL_HapticConstant
constant
Constant effect.SDL_HapticCustom
custom
Custom effect.SDL_HapticLeftRight
leftright
Left/Right effect.SDL_HapticPeriodic
periodic
Periodic effect.SDL_HapticRamp
ramp
Ramp effect.short
type
Effect type.
-
Constructor Summary
Constructors Constructor Description SDL_HapticEffect()
SDL_HapticEffect(com.sun.jna.Pointer p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
read()
void
setType(int hapticEffectType)
-
Methods inherited from class com.sun.jna.Union
getFieldOrder, getNativeAlignment, getTypedValue, readField, readField, setType, setType, setTypedValue, writeField, writeField, writeField
-
Methods inherited from class com.sun.jna.Structure
allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, calculateSize, clear, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFields, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setStringEncoding, size, sortFields, toArray, toArray, toString, toString, useMemory, useMemory, write
-
-
-
-
Field Detail
-
type
public short type
Effect type.
-
constant
public SDL_HapticConstant constant
Constant effect.
-
periodic
public SDL_HapticPeriodic periodic
Periodic effect.
-
condition
public SDL_HapticCondition condition
Condition effect.
-
ramp
public SDL_HapticRamp ramp
Ramp effect.
-
leftright
public SDL_HapticLeftRight leftright
Left/Right effect.
-
custom
public SDL_HapticCustom custom
Custom effect.
-
-