|
SDL3pp
A slim C++ wrapper for SDL3
|
The SDL haptic subsystem manages haptic (force feedback) devices. More...
Classes | |
| struct | SDL::Haptic |
| The haptic structure used to identify an SDL haptic. More... | |
Typedefs | |
| using | SDL::HapticRaw = SDL_Haptic* |
| Alias to raw representation for Haptic. | |
| using | SDL::HapticRef = ResourceRef<Haptic> |
| Reference for Haptic. | |
| using | SDL::HapticDirection = SDL_HapticDirection |
| Structure that represents a haptic direction. | |
| using | SDL::HapticConstant = SDL_HapticConstant |
| A structure containing a template for a Constant effect. | |
| using | SDL::HapticPeriodic = SDL_HapticPeriodic |
| A structure containing a template for a Periodic effect. | |
| using | SDL::HapticCondition = SDL_HapticCondition |
| A structure containing a template for a Condition effect. | |
| using | SDL::HapticRamp = SDL_HapticRamp |
| A structure containing a template for a Ramp effect. | |
| using | SDL::HapticLeftRight = SDL_HapticLeftRight |
| A structure containing a template for a Left/Right effect. | |
| using | SDL::HapticCustom = SDL_HapticCustom |
| A structure containing a template for the HAPTIC_CUSTOM effect. | |
| using | SDL::HapticEffect = SDL_HapticEffect |
| The generic template for any haptic effect. | |
| using | SDL::HapticID = SDL_HapticID |
| This is a unique ID for a haptic device for the time it is connected to the system, and is never reused for the lifetime of the application. | |
Functions | |
| OwnArray< HapticID > | SDL::GetHaptics () |
| Get a list of currently connected haptic devices. | |
| const char * | SDL::GetHapticNameForID (HapticID instance_id) |
| Get the implementation dependent name of a haptic device. | |
| Haptic | SDL::OpenHaptic (HapticID instance_id) |
| Open a haptic device for use. | |
| HapticRef | SDL::GetHapticFromID (HapticID instance_id) |
| Get the Haptic associated with an instance ID, if it has been opened. | |
| HapticID | SDL::GetHapticID (HapticRef haptic) |
| Get the instance ID of an opened haptic device. | |
| const char * | SDL::GetHapticName (HapticRef haptic) |
| Get the implementation dependent name of a haptic device. | |
| bool | SDL::IsMouseHaptic () |
| Query whether or not the current mouse has haptic capabilities. | |
| Haptic | SDL::OpenHapticFromMouse () |
| Try to open a haptic device from the current mouse. | |
| bool | SDL::IsJoystickHaptic (JoystickRef joystick) |
| Query if a joystick has haptic features. | |
| Haptic | SDL::OpenHapticFromJoystick (JoystickRef joystick) |
| Open a haptic device for use from a joystick device. | |
| void | SDL::CloseHaptic (HapticRaw haptic) |
| Close a haptic device previously opened with OpenHaptic(). | |
| int | SDL::GetMaxHapticEffects (HapticRef haptic) |
| Get the number of effects a haptic device can store. | |
| int | SDL::GetMaxHapticEffectsPlaying (HapticRef haptic) |
| Get the number of effects a haptic device can play at the same time. | |
| Uint32 | SDL::GetHapticFeatures (HapticRef haptic) |
| Get the haptic device's supported features in bitwise manner. | |
| int | SDL::GetNumHapticAxes (HapticRef haptic) |
| Get the number of haptic axes the device has. | |
| bool | SDL::HapticEffectSupported (HapticRef haptic, const HapticEffect &effect) |
| Check to see if an effect is supported by a haptic device. | |
| HapticEffectID | SDL::CreateHapticEffect (HapticRef haptic, const HapticEffect &effect) |
| Create a new haptic effect on a specified device. | |
| void | SDL::UpdateHapticEffect (HapticRef haptic, HapticEffectID effect, const HapticEffect &data) |
| Update the properties of an effect. | |
| void | SDL::RunHapticEffect (HapticRef haptic, HapticEffectID effect, Uint32 iterations) |
| Run the haptic effect on its associated haptic device. | |
| void | SDL::StopHapticEffect (HapticRef haptic, HapticEffectID effect) |
| Stop the haptic effect on its associated haptic device. | |
| void | SDL::DestroyHapticEffect (HapticRef haptic, HapticEffectID effect) |
| Destroy a haptic effect on the device. | |
| bool | SDL::GetHapticEffectStatus (HapticRef haptic, HapticEffectID effect) |
| Get the status of the current effect on the specified haptic device. | |
| void | SDL::SetHapticGain (HapticRef haptic, int gain) |
| Set the global gain of the specified haptic device. | |
| void | SDL::SetHapticAutocenter (HapticRef haptic, int autocenter) |
| Set the global autocenter of the device. | |
| void | SDL::PauseHaptic (HapticRef haptic) |
| Pause a haptic device. | |
| void | SDL::ResumeHaptic (HapticRef haptic) |
| Resume a haptic device. | |
| void | SDL::StopHapticEffects (HapticRef haptic) |
| Stop all the currently playing effects on a haptic device. | |
| bool | SDL::HapticRumbleSupported (HapticRef haptic) |
| Check whether rumble is supported on a haptic device. | |
| void | SDL::InitHapticRumble (HapticRef haptic) |
| Initialize a haptic device for simple rumble playback. | |
| void | SDL::PlayHapticRumble (HapticRef haptic, float strength, Uint32 length) |
| Run a simple rumble effect on a haptic device. | |
| void | SDL::StopHapticRumble (HapticRef haptic) |
| Stop the simple rumble on a haptic device. | |
| SDL::Haptic::Haptic (HapticID instance_id) | |
| Open a haptic device for use. | |
| SDL::Haptic::Haptic (JoystickRef joystick) | |
| Open a haptic device for use from a joystick device. | |
| HapticID | SDL::Haptic::GetID () |
| Get the instance ID of an opened haptic device. | |
| const char * | SDL::Haptic::GetName () |
| Get the implementation dependent name of a haptic device. | |
| static Haptic | SDL::Haptic::OpenFromMouse () |
| Try to open a haptic device from the current mouse. | |
| void | SDL::Haptic::Close () |
| Close a haptic device previously opened with OpenHaptic(). | |
| int | SDL::Haptic::GetMaxEffects () |
| Get the number of effects a haptic device can store. | |
| int | SDL::Haptic::GetMaxEffectsPlaying () |
| Get the number of effects a haptic device can play at the same time. | |
| Uint32 | SDL::Haptic::GetFeatures () |
| Get the haptic device's supported features in bitwise manner. | |
| int | SDL::Haptic::GetNumAxes () |
| Get the number of haptic axes the device has. | |
| bool | SDL::Haptic::EffectSupported (const HapticEffect &effect) |
| Check to see if an effect is supported by a haptic device. | |
| HapticEffectID | SDL::Haptic::CreateEffect (const HapticEffect &effect) |
| Create a new haptic effect on a specified device. | |
| void | SDL::Haptic::UpdateEffect (HapticEffectID effect, const HapticEffect &data) |
| Update the properties of an effect. | |
| void | SDL::Haptic::RunEffect (HapticEffectID effect, Uint32 iterations) |
| Run the haptic effect on its associated haptic device. | |
| void | SDL::Haptic::StopEffect (HapticEffectID effect) |
| Stop the haptic effect on its associated haptic device. | |
| void | SDL::Haptic::DestroyEffect (HapticEffectID effect) |
| Destroy a haptic effect on the device. | |
| bool | SDL::Haptic::GetEffectStatus (HapticEffectID effect) |
| Get the status of the current effect on the specified haptic device. | |
| void | SDL::Haptic::SetGain (int gain) |
| Set the global gain of the specified haptic device. | |
| void | SDL::Haptic::SetAutocenter (int autocenter) |
| Set the global autocenter of the device. | |
| void | SDL::Haptic::Pause () |
| Pause a haptic device. | |
| void | SDL::Haptic::Resume () |
| Resume a haptic device. | |
| void | SDL::Haptic::StopEffects () |
| Stop all the currently playing effects on a haptic device. | |
| bool | SDL::Haptic::RumbleSupported () |
| Check whether rumble is supported on a haptic device. | |
| void | SDL::Haptic::InitRumble () |
| Initialize a haptic device for simple rumble playback. | |
| void | SDL::Haptic::PlayRumble (float strength, Uint32 length) |
| Run a simple rumble effect on a haptic device. | |
| void | SDL::Haptic::StopRumble () |
| Stop the simple rumble on a haptic device. | |
Variables | |
| constexpr Uint32 | SDL::HAPTIC_INFINITY = SDL_HAPTIC_INFINITY |
| Used to play a device an infinite number of times. | |
Haptic effects | |
| using | SDL::HapticEffectID = int |
| ID for haptic effects. | |
| using | SDL::HapticEffectType = Uint32 |
| Type of haptic effect. | |
| constexpr HapticEffectType | SDL::HAPTIC_CONSTANT = SDL_HAPTIC_CONSTANT |
| Constant effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_SINE = SDL_HAPTIC_SINE |
| Sine wave effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_SQUARE = SDL_HAPTIC_SQUARE |
| Square wave effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_TRIANGLE = SDL_HAPTIC_TRIANGLE |
| Triangle wave effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_SAWTOOTHUP = SDL_HAPTIC_SAWTOOTHUP |
| Sawtoothup wave effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_SAWTOOTHDOWN = SDL_HAPTIC_SAWTOOTHDOWN |
| Sawtoothdown wave effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_RAMP = SDL_HAPTIC_RAMP |
| Ramp effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_SPRING = SDL_HAPTIC_SPRING |
| Spring effect supported - uses axes position. | |
| constexpr HapticEffectType | SDL::HAPTIC_DAMPER = SDL_HAPTIC_DAMPER |
| Damper effect supported - uses axes velocity. | |
| constexpr HapticEffectType | SDL::HAPTIC_INERTIA = SDL_HAPTIC_INERTIA |
| Inertia effect supported - uses axes acceleration. | |
| constexpr HapticEffectType | SDL::HAPTIC_FRICTION = SDL_HAPTIC_FRICTION |
| Friction effect supported - uses axes movement. | |
| constexpr HapticEffectType | SDL::HAPTIC_LEFTRIGHT = SDL_HAPTIC_LEFTRIGHT |
| Left/Right effect supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_RESERVED1 = SDL_HAPTIC_RESERVED1 |
| Reserved for future use. | |
| constexpr HapticEffectType | SDL::HAPTIC_RESERVED2 = SDL_HAPTIC_RESERVED2 |
| Reserved for future use. | |
| constexpr HapticEffectType | SDL::HAPTIC_RESERVED3 = SDL_HAPTIC_RESERVED3 |
| Reserved for future use. | |
| constexpr HapticEffectType | SDL::HAPTIC_CUSTOM = SDL_HAPTIC_CUSTOM |
| Custom effect is supported. | |
| constexpr HapticEffectType | SDL::HAPTIC_GAIN = SDL_HAPTIC_GAIN |
| Device can set global gain. | |
| constexpr HapticEffectType | SDL::HAPTIC_AUTOCENTER = SDL_HAPTIC_AUTOCENTER |
| Device can set autocenter. | |
| constexpr HapticEffectType | SDL::HAPTIC_STATUS = SDL_HAPTIC_STATUS |
| Device can be queried for effect status. | |
| constexpr HapticEffectType | SDL::HAPTIC_PAUSE = SDL_HAPTIC_PAUSE |
| Device can be paused. | |
Direction encodings | |
| using | SDL::HapticDirectionType = Uint8 |
| Type of coordinates used for haptic direction. | |
| constexpr HapticDirectionType | SDL::HAPTIC_POLAR = SDL_HAPTIC_POLAR |
| Uses polar coordinates for the direction. | |
| constexpr HapticDirectionType | SDL::HAPTIC_CARTESIAN = SDL_HAPTIC_CARTESIAN |
| Uses cartesian coordinates for the direction. | |
| constexpr HapticDirectionType | SDL::HAPTIC_SPHERICAL = SDL_HAPTIC_SPHERICAL |
| Uses spherical coordinates for the direction. | |
| constexpr HapticDirectionType | SDL::HAPTIC_STEERING_AXIS = SDL_HAPTIC_STEERING_AXIS |
| Use this value to play an effect on the steering wheel axis. | |
The SDL haptic subsystem manages haptic (force feedback) devices.
The basic usage is as follows:
Simple rumble example:
Complete example:
Note that the SDL haptic subsystem is not thread-safe.
| using SDL::HapticCondition = SDL_HapticCondition |
A structure containing a template for a Condition effect.
The struct handles the following effects:
Direction is handled by condition internals instead of a direction member. The condition effect specific members have three parameters. The first refers to the X axis, the second refers to the Y axis and the third refers to the Z axis. The right terms refer to the positive side of the axis and the left terms refer to the negative side of the axis. Please refer to the HapticDirection diagram for which side is positive and which is negative.
| using SDL::HapticConstant = SDL_HapticConstant |
A structure containing a template for a Constant effect.
This struct is exclusively for the HAPTIC_CONSTANT effect.
A constant effect applies a constant force in the specified direction to the joystick.
| using SDL::HapticCustom = SDL_HapticCustom |
A structure containing a template for the HAPTIC_CUSTOM effect.
This struct is exclusively for the HAPTIC_CUSTOM effect.
A custom force feedback effect is much like a periodic effect, where the application can define its exact shape. You will have to allocate the data yourself. Data should consist of channels * samples Uint16 samples.
If channels is one, the effect is rotated using the defined direction. Otherwise it uses the samples in data for the different axes.
| using SDL::HapticDirection = SDL_HapticDirection |
Structure that represents a haptic direction.
This is the direction where the force comes from, instead of the direction in which the force is exerted.
Directions can be specified by:
Cardinal directions of the haptic device are relative to the positioning of the device. North is considered to be away from the user.
The following diagram represents the cardinal directions:
If type is HAPTIC_POLAR, direction is encoded by hundredths of a degree starting north and turning clockwise. HAPTIC_POLAR only uses the first dir parameter. The cardinal directions would be:
If type is HAPTIC_CARTESIAN, direction is encoded by three positions (X axis, Y axis and Z axis (with 3 axes)). HAPTIC_CARTESIAN uses the first three dir parameters. The cardinal directions would be:
The Z axis represents the height of the effect if supported, otherwise it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can use any multiple you want, only the direction matters.
If type is HAPTIC_SPHERICAL, direction is encoded by two rotations. The first two dir parameters are used. The dir parameters are as follows (all values are in hundredths of degrees):
Example of force coming from the south with all encodings (force coming from the south means the user will have to pull the stick to counteract):
| using SDL::HapticEffect = SDL_HapticEffect |
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 HAPTIC_INFINITY to length instead of a 0-32767 value. Neither delay, interval, attack_length nor fade_length support HAPTIC_INFINITY. Fade will also not be used since effect never ends.
Additionally, the HAPTIC_RAMP effect does not support a duration of 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:
Here we have an example of a constant effect evolution in time:
Note either the attack_level or the fade_level may be above the actual effect level.
| using SDL::HapticEffectID = int |
| using SDL::HapticID = SDL_HapticID |
This is a unique ID for a haptic device for the time it is connected to the system, and is never reused for the lifetime of the application.
If the haptic device is disconnected and reconnected, it will get a new ID.
The value 0 is an invalid ID.
| using SDL::HapticLeftRight = SDL_HapticLeftRight |
A structure containing a template for a Left/Right effect.
This struct is exclusively for the HAPTIC_LEFTRIGHT effect.
The Left/Right effect is used to explicitly control the large and small motors, commonly found in modern game controllers. The small (right) motor is high frequency, and the large (left) motor is low frequency.
| using SDL::HapticPeriodic = SDL_HapticPeriodic |
A structure containing a template for a Periodic effect.
The struct handles the following effects:
A periodic effect consists in a wave-shaped effect that repeats itself over time. The type determines the shape of the wave and the parameters determine the dimensions of the wave.
Phase is given by hundredth of a degree meaning that giving the phase a value of 9000 will displace it 25% of its period. Here are sample values:
Examples:
| using SDL::HapticRamp = SDL_HapticRamp |
A structure containing a template for a Ramp effect.
This struct is exclusively for the HAPTIC_RAMP effect.
The ramp effect starts at start strength and ends at end strength. It augments in linear fashion. If you use attack and fade with a ramp the effects get added to the ramp effect making the effect become quadratic instead of linear.
| using SDL::HapticRef = ResourceRef<Haptic> |
Reference for Haptic.
This does not take ownership!
|
inline |
Close a haptic device previously opened with OpenHaptic().
|
inline |
Close a haptic device previously opened with OpenHaptic().
| haptic | the Haptic device to close. |
|
inline |
Create a new haptic effect on a specified device.
| effect | an HapticEffect structure containing the properties of the effect to create. |
| Error | on failure. |
|
inline |
Create a new haptic effect on a specified device.
| haptic | an Haptic device to create the effect on. |
| effect | an HapticEffect structure containing the properties of the effect to create. |
| Error | on failure. |
|
inline |
Destroy a haptic effect on the device.
This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.
| effect | the ID of the haptic effect to destroy. |
|
inline |
Destroy a haptic effect on the device.
This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.
| haptic | the Haptic device to destroy the effect on. |
| effect | the ID of the haptic effect to destroy. |
|
inline |
Check to see if an effect is supported by a haptic device.
| effect | the desired effect to query. |
|
inline |
Get the status of the current effect on the specified haptic device.
Device must support the HAPTIC_STATUS feature.
| effect | the ID of the haptic effect to query its status. |
|
inline |
|
inline |
Get the status of the current effect on the specified haptic device.
Device must support the HAPTIC_STATUS feature.
| haptic | the Haptic device to query for the effect status on. |
| effect | the ID of the haptic effect to query its status. |
|
inline |
Get the implementation dependent name of a haptic device.
| haptic | the Haptic obtained from JoystickID.OpenJoystick(). |
|
inline |
Get the implementation dependent name of a haptic device.
This can be called before any haptic devices are opened.
| instance_id | the haptic device instance ID. |
Get a list of currently connected haptic devices.
|
inline |
|
inline |
Get the number of effects a haptic device can store.
On some platforms this isn't fully supported, and therefore is an approximation. Always check to see if your created effect was actually created and do not rely solely on Haptic.GetMaxEffects().
|
inline |
Get the number of effects a haptic device can play at the same time.
This is not supported on all platforms, but will always return a value.
|
inline |
Get the number of effects a haptic device can store.
On some platforms this isn't fully supported, and therefore is an approximation. Always check to see if your created effect was actually created and do not rely solely on Haptic.GetMaxEffects().
| haptic | the Haptic device to query. |
|
inline |
Get the number of effects a haptic device can play at the same time.
This is not supported on all platforms, but will always return a value.
| haptic | the Haptic device to query maximum playing effects. |
|
inline |
Get the implementation dependent name of a haptic device.
|
inline |
Get the number of haptic axes the device has.
The number of haptic axes might be useful if working with the HapticDirection effect.
| Error | on failure. |
|
inline |
Get the number of haptic axes the device has.
The number of haptic axes might be useful if working with the HapticDirection effect.
| haptic | the Haptic device to query. |
| Error | on failure. |
|
inline |
Open a haptic device for use.
The index passed as an argument refers to the N'th haptic device on this system.
When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use Haptic.SetGain() and Haptic.SetAutocenter().
| instance_id | the haptic device instance ID. |
|
inline |
Open a haptic device for use from a joystick device.
You must still close the haptic device separately. It will not be closed with the joystick.
When opened from a joystick you should first close the haptic device before closing the joystick device. If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.
| joystick | the Joystick to create a haptic device from. |
| Error | on failure. |
|
inline |
|
inline |
Check whether rumble is supported on a haptic device.
| haptic | haptic device to check for rumble support. |
|
inline |
|
inline |
|
inline |
Query if a joystick has haptic features.
| joystick | the Joystick to test for haptic capabilities. |
|
inline |
Query whether or not the current mouse has haptic capabilities.
|
inlinestatic |
Try to open a haptic device from the current mouse.
Open a haptic device for use.
The index passed as an argument refers to the N'th haptic device on this system.
When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use Haptic.SetGain() and Haptic.SetAutocenter().
| instance_id | the haptic device instance ID. |
|
inline |
Open a haptic device for use from a joystick device.
You must still close the haptic device separately. It will not be closed with the joystick.
When opened from a joystick you should first close the haptic device before closing the joystick device. If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.
| joystick | the Joystick to create a haptic device from. |
| Error | on failure. |
|
inline |
Try to open a haptic device from the current mouse.
|
inline |
Pause a haptic device.
Device must support the HAPTIC_PAUSE feature. Call Haptic.Resume() to resume playback.
Do not modify the effects nor add new ones while the device is paused. That can cause all sorts of weird errors.
| Error | on failure. |
|
inline |
Pause a haptic device.
Device must support the HAPTIC_PAUSE feature. Call Haptic.Resume() to resume playback.
Do not modify the effects nor add new ones while the device is paused. That can cause all sorts of weird errors.
| haptic | the Haptic device to pause. |
| Error | on failure. |
Run a simple rumble effect on a haptic device.
| haptic | the haptic device to play the rumble effect on. |
| strength | strength of the rumble to play as a 0-1 float value. |
| length | length of the rumble to play in milliseconds. |
| Error | on failure. |
|
inline |
Run a simple rumble effect on a haptic device.
| strength | strength of the rumble to play as a 0-1 float value. |
| length | length of the rumble to play in milliseconds. |
| Error | on failure. |
|
inline |
Resume a haptic device.
Call to unpause after Haptic.Pause().
| Error | on failure. |
|
inline |
Resume a haptic device.
Call to unpause after Haptic.Pause().
| haptic | the Haptic device to unpause. |
| Error | on failure. |
|
inline |
Check whether rumble is supported on a haptic device.
|
inline |
Run the haptic effect on its associated haptic device.
To repeat the effect over and over indefinitely, set iterations to HAPTIC_INFINITY. (Repeats the envelope - attack and fade.) To make one instance of the effect last indefinitely (so the effect does not fade), set the effect's length in its structure/union to HAPTIC_INFINITY instead.
| effect | the ID of the haptic effect to run. |
| iterations | the number of iterations to run the effect; use HAPTIC_INFINITY to repeat forever. |
| Error | on failure. |
|
inline |
Run the haptic effect on its associated haptic device.
To repeat the effect over and over indefinitely, set iterations to HAPTIC_INFINITY. (Repeats the envelope - attack and fade.) To make one instance of the effect last indefinitely (so the effect does not fade), set the effect's length in its structure/union to HAPTIC_INFINITY instead.
| haptic | the Haptic device to run the effect on. |
| effect | the ID of the haptic effect to run. |
| iterations | the number of iterations to run the effect; use HAPTIC_INFINITY to repeat forever. |
| Error | on failure. |
|
inline |
Set the global autocenter of the device.
Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.
Device must support the HAPTIC_AUTOCENTER feature.
| autocenter | value to set autocenter to (0-100). |
| Error | on failure. |
|
inline |
Set the global gain of the specified haptic device.
Device must support the HAPTIC_GAIN feature.
The user may specify the maximum gain by setting the environment variable SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to Haptic.SetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.
| gain | value to set the gain to, should be between 0 and 100 (0 - 100). |
| Error | on failure. |
|
inline |
Set the global autocenter of the device.
Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.
Device must support the HAPTIC_AUTOCENTER feature.
| haptic | the Haptic device to set autocentering on. |
| autocenter | value to set autocenter to (0-100). |
| Error | on failure. |
|
inline |
Set the global gain of the specified haptic device.
Device must support the HAPTIC_GAIN feature.
The user may specify the maximum gain by setting the environment variable SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to Haptic.SetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.
| haptic | the Haptic device to set the gain on. |
| gain | value to set the gain to, should be between 0 and 100 (0 - 100). |
| Error | on failure. |
|
inline |
Stop the haptic effect on its associated haptic device.
| effect | the ID of the haptic effect to stop. |
| Error | on failure. |
|
inline |
Stop all the currently playing effects on a haptic device.
| Error | on failure. |
|
inline |
Stop the haptic effect on its associated haptic device.
| haptic | the Haptic device to stop the effect on. |
| effect | the ID of the haptic effect to stop. |
| Error | on failure. |
|
inline |
Stop all the currently playing effects on a haptic device.
| haptic | the Haptic device to stop. |
| Error | on failure. |
|
inline |
Stop the simple rumble on a haptic device.
| haptic | the haptic device to stop the rumble effect on. |
| Error | on failure. |
|
inline |
Stop the simple rumble on a haptic device.
| Error | on failure. |
|
inline |
Update the properties of an effect.
Can be used dynamically, although behavior when dynamically changing direction may be strange. Specifically the effect may re-upload itself and start playing from the start. You also cannot change the type either when running Haptic.UpdateEffect().
| effect | the identifier of the effect to update. |
| data | an HapticEffect structure containing the new effect properties to use. |
| Error | on failure. |
|
inline |
Update the properties of an effect.
Can be used dynamically, although behavior when dynamically changing direction may be strange. Specifically the effect may re-upload itself and start playing from the start. You also cannot change the type either when running Haptic.UpdateEffect().
| haptic | the Haptic device that has the effect. |
| effect | the identifier of the effect to update. |
| data | an HapticEffect structure containing the new effect properties to use. |
| Error | on failure. |
|
constexpr |
Device can set autocenter.
Device supports setting autocenter.
|
constexpr |
Uses cartesian coordinates for the direction.
|
constexpr |
Constant effect supported.
Constant haptic effect.
|
constexpr |
Custom effect is supported.
User defined custom haptic effect.
|
constexpr |
Damper effect supported - uses axes velocity.
Condition haptic effect that simulates dampening. Effect is based on the axes velocity.
|
constexpr |
Friction effect supported - uses axes movement.
Condition haptic effect that simulates friction. Effect is based on the axes movement.
|
constexpr |
Device can set global gain.
Device supports setting the global gain.
|
constexpr |
Inertia effect supported - uses axes acceleration.
Condition haptic effect that simulates inertia. Effect is based on the axes acceleration.
|
constexpr |
Used to play a device an infinite number of times.
|
constexpr |
Left/Right effect supported.
Haptic effect for direct control over high/low frequency motors.
|
constexpr |
Device can be paused.
Devices supports being paused.
|
constexpr |
Uses polar coordinates for the direction.
|
constexpr |
Ramp effect supported.
Ramp haptic effect.
|
constexpr |
Reserved for future use.
|
constexpr |
Reserved for future use.
|
constexpr |
Reserved for future use.
|
constexpr |
Sawtoothdown wave effect supported.
Periodic haptic effect that simulates saw tooth down waves.
|
constexpr |
Sawtoothup wave effect supported.
Periodic haptic effect that simulates saw tooth up waves.
|
constexpr |
Sine wave effect supported.
Periodic haptic effect that simulates sine waves.
|
constexpr |
Uses spherical coordinates for the direction.
|
constexpr |
Spring effect supported - uses axes position.
Condition haptic effect that simulates a spring. Effect is based on the axes position.
|
constexpr |
Square wave effect supported.
Periodic haptic effect that simulates square waves.
|
constexpr |
Device can be queried for effect status.
Device supports querying effect status.
|
constexpr |
Use this value to play an effect on the steering wheel axis.
This provides better compatibility across platforms and devices as SDL will guess the correct axis.
|
constexpr |
Triangle wave effect supported.
Periodic haptic effect that simulates triangular waves.