NAME
SDL2::HapticEffect - A generic template for a any haptic effect
SYNOPSIS
use SDL2 qw[:all];
# TODO: I need to whip up a quick example
DESCRIPTION
SDL2::HapticEffect is a C union which generalizes all known haptic effects.
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 SDL_HAPTIC_INFINITY
. Fade will also not be used since effect never 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:
- Replay - All effects have this
- Trigger - All effects have this
- Envelope - All effects except condition effects have this
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 C<attack_level> or the C<fade_level> may be above the actual
effect level.
Fields
As a union, this object main contain the following structures:
type
- Effect typeconstant
- SDL2::HapticConstantperiodic
- SDL2::HapticPeriodiccondition
- SDL2::HapticConditionramp
- SDL2::HapticRampleftright
- SDL2::HapticLeftRightcustom
- SDL2::HapticCustom
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
AUTHOR
Sanko Robinson <sanko@cpan.org>