SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
Force Feedback Support

The SDL haptic subsystem manages haptic (force feedback) devices. More...

Collaboration diagram for Force Feedback Support:

Classes

struct  SDL::HapticParam
 Safely wrap Haptic for non owning parameters. More...
 
class  SDL::Haptic
 The haptic structure used to identify an SDL haptic. More...
 
struct  SDL::HapticRef
 Semi-safe reference for Haptic. More...
 

Typedefs

using SDL::HapticRaw = SDL_Haptic *
 Alias to raw representation for Haptic.
 
using SDL::HapticDirection = SDL_HapticDirection
 Structure that represents a haptic direction. More...
 
using SDL::HapticConstant = SDL_HapticConstant
 A structure containing a template for a Constant effect. More...
 
using SDL::HapticPeriodic = SDL_HapticPeriodic
 A structure containing a template for a Periodic effect. More...
 
using SDL::HapticCondition = SDL_HapticCondition
 A structure containing a template for a Condition effect. More...
 
using SDL::HapticRamp = SDL_HapticRamp
 A structure containing a template for a Ramp effect. More...
 
using SDL::HapticLeftRight = SDL_HapticLeftRight
 A structure containing a template for a Left/Right effect. More...
 
using SDL::HapticCustom = SDL_HapticCustom
 A structure containing a template for the HAPTIC_CUSTOM effect. More...
 
using SDL::HapticEffect = SDL_HapticEffect
 The generic template for any haptic effect. More...
 
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. More...
 

Functions

OwnArray< HapticIDSDL::GetHaptics ()
 Get a list of currently connected haptic devices. More...
 
const char * SDL::GetHapticNameForID (HapticID instance_id)
 Get the implementation dependent name of a haptic device. More...
 
Haptic SDL::OpenHaptic (HapticID instance_id)
 Open a haptic device for use. More...
 
HapticRef SDL::GetHapticFromID (HapticID instance_id)
 Get the Haptic associated with an instance ID, if it has been opened. More...
 
HapticID SDL::GetHapticID (HapticParam haptic)
 Get the instance ID of an opened haptic device. More...
 
const char * SDL::GetHapticName (HapticParam haptic)
 Get the implementation dependent name of a haptic device. More...
 
bool SDL::IsMouseHaptic ()
 Query whether or not the current mouse has haptic capabilities. More...
 
Haptic SDL::OpenHapticFromMouse ()
 Try to open a haptic device from the current mouse. More...
 
bool SDL::IsJoystickHaptic (JoystickParam joystick)
 Query if a joystick has haptic features. More...
 
Haptic SDL::OpenHapticFromJoystick (JoystickParam joystick)
 Open a haptic device for use from a joystick device. More...
 
void SDL::CloseHaptic (HapticRaw haptic)
 Close a haptic device previously opened with Haptic.Haptic(). More...
 
int SDL::GetMaxHapticEffects (HapticParam haptic)
 Get the number of effects a haptic device can store. More...
 
int SDL::GetMaxHapticEffectsPlaying (HapticParam haptic)
 Get the number of effects a haptic device can play at the same time. More...
 
Uint32 SDL::GetHapticFeatures (HapticParam haptic)
 Get the haptic device's supported features in bitwise manner. More...
 
int SDL::GetNumHapticAxes (HapticParam haptic)
 Get the number of haptic axes the device has. More...
 
bool SDL::HapticEffectSupported (HapticParam haptic, const HapticEffect &effect)
 Check to see if an effect is supported by a haptic device. More...
 
int SDL::CreateHapticEffect (HapticParam haptic, const HapticEffect &effect)
 Create a new haptic effect on a specified device. More...
 
void SDL::UpdateHapticEffect (HapticParam haptic, int effect, const HapticEffect &data)
 Update the properties of an effect. More...
 
void SDL::RunHapticEffect (HapticParam haptic, int effect, Uint32 iterations)
 Run the haptic effect on its associated haptic device. More...
 
void SDL::StopHapticEffect (HapticParam haptic, int effect)
 Stop the haptic effect on its associated haptic device. More...
 
void SDL::DestroyHapticEffect (HapticParam haptic, int effect)
 Destroy a haptic effect on the device. More...
 
bool SDL::GetHapticEffectStatus (HapticParam haptic, int effect)
 Get the status of the current effect on the specified haptic device. More...
 
void SDL::SetHapticGain (HapticParam haptic, int gain)
 Set the global gain of the specified haptic device. More...
 
void SDL::SetHapticAutocenter (HapticParam haptic, int autocenter)
 Set the global autocenter of the device. More...
 
void SDL::PauseHaptic (HapticParam haptic)
 Pause a haptic device. More...
 
void SDL::ResumeHaptic (HapticParam haptic)
 Resume a haptic device. More...
 
void SDL::StopHapticEffects (HapticParam haptic)
 Stop all the currently playing effects on a haptic device. More...
 
bool SDL::HapticRumbleSupported (HapticParam haptic)
 Check whether rumble is supported on a haptic device. More...
 
void SDL::InitHapticRumble (HapticParam haptic)
 Initialize a haptic device for simple rumble playback. More...
 
void SDL::PlayHapticRumble (HapticParam haptic, float strength, Uint32 length)
 Run a simple rumble effect on a haptic device. More...
 
void SDL::StopHapticRumble (HapticParam haptic)
 Stop the simple rumble on a haptic device. More...
 
HapticID SDL::Haptic::GetID ()
 Get the instance ID of an opened haptic device. More...
 
const char * SDL::Haptic::GetName ()
 Get the implementation dependent name of a haptic device. More...
 
static Haptic SDL::Haptic::OpenFromMouse ()
 Try to open a haptic device from the current mouse. More...
 
void SDL::Haptic::Close ()
 Close a haptic device previously opened with Haptic.Haptic(). More...
 
int SDL::Haptic::GetMaxEffects ()
 Get the number of effects a haptic device can store. More...
 
int SDL::Haptic::GetMaxEffectsPlaying ()
 Get the number of effects a haptic device can play at the same time. More...
 
Uint32 SDL::Haptic::GetFeatures ()
 Get the haptic device's supported features in bitwise manner. More...
 
int SDL::Haptic::GetNumAxes ()
 Get the number of haptic axes the device has. More...
 
bool SDL::Haptic::EffectSupported (const HapticEffect &effect)
 Check to see if an effect is supported by a haptic device. More...
 
int SDL::Haptic::CreateEffect (const HapticEffect &effect)
 Create a new haptic effect on a specified device. More...
 
void SDL::Haptic::UpdateEffect (int effect, const HapticEffect &data)
 Update the properties of an effect. More...
 
void SDL::Haptic::RunEffect (int effect, Uint32 iterations)
 Run the haptic effect on its associated haptic device. More...
 
void SDL::Haptic::StopEffect (int effect)
 Stop the haptic effect on its associated haptic device. More...
 
void SDL::Haptic::DestroyEffect (int effect)
 Destroy a haptic effect on the device. More...
 
bool SDL::Haptic::GetEffectStatus (int effect)
 Get the status of the current effect on the specified haptic device. More...
 
void SDL::Haptic::SetGain (int gain)
 Set the global gain of the specified haptic device. More...
 
void SDL::Haptic::SetAutocenter (int autocenter)
 Set the global autocenter of the device. More...
 
void SDL::Haptic::Pause ()
 Pause a haptic device. More...
 
void SDL::Haptic::Resume ()
 Resume a haptic device. More...
 
void SDL::Haptic::StopEffects ()
 Stop all the currently playing effects on a haptic device. More...
 
bool SDL::Haptic::RumbleSupported ()
 Check whether rumble is supported on a haptic device. More...
 
void SDL::Haptic::InitRumble ()
 Initialize a haptic device for simple rumble playback. More...
 
void SDL::Haptic::PlayRumble (float strength, Uint32 length)
 Run a simple rumble effect on a haptic device. More...
 
void SDL::Haptic::StopRumble ()
 Stop the simple rumble on a haptic device. More...
 

Variables

constexpr Uint32 SDL::HAPTIC_INFINITY = SDL_HAPTIC_INFINITY
 Used to play a device an infinite number of times. More...
 

Haptic effects

using SDL::HapticEffectType = Uint32
 Haptic effects flag constants. More...
 
constexpr HapticEffectType SDL::HAPTIC_CONSTANT = SDL_HAPTIC_CONSTANT
 Constant effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_SINE = SDL_HAPTIC_SINE
 Sine wave effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_SQUARE = SDL_HAPTIC_SQUARE
 Square wave effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_TRIANGLE = SDL_HAPTIC_TRIANGLE
 Triangle wave effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_SAWTOOTHUP = SDL_HAPTIC_SAWTOOTHUP
 Sawtoothup wave effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_SAWTOOTHDOWN = SDL_HAPTIC_SAWTOOTHDOWN
 Sawtoothdown wave effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_RAMP = SDL_HAPTIC_RAMP
 Ramp effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_SPRING = SDL_HAPTIC_SPRING
 Spring effect supported - uses axes position. More...
 
constexpr HapticEffectType SDL::HAPTIC_DAMPER = SDL_HAPTIC_DAMPER
 Damper effect supported - uses axes velocity. More...
 
constexpr HapticEffectType SDL::HAPTIC_INERTIA = SDL_HAPTIC_INERTIA
 Inertia effect supported - uses axes acceleration. More...
 
constexpr HapticEffectType SDL::HAPTIC_FRICTION = SDL_HAPTIC_FRICTION
 Friction effect supported - uses axes movement. More...
 
constexpr HapticEffectType SDL::HAPTIC_LEFTRIGHT = SDL_HAPTIC_LEFTRIGHT
 Left/Right effect supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_RESERVED1 = SDL_HAPTIC_RESERVED1
 Reserved for future use. More...
 
constexpr HapticEffectType SDL::HAPTIC_RESERVED2 = SDL_HAPTIC_RESERVED2
 Reserved for future use. More...
 
constexpr HapticEffectType SDL::HAPTIC_RESERVED3 = SDL_HAPTIC_RESERVED3
 Reserved for future use. More...
 
constexpr HapticEffectType SDL::HAPTIC_CUSTOM = SDL_HAPTIC_CUSTOM
 Custom effect is supported. More...
 
constexpr HapticEffectType SDL::HAPTIC_GAIN = SDL_HAPTIC_GAIN
 Device can set global gain. More...
 
constexpr HapticEffectType SDL::HAPTIC_AUTOCENTER = SDL_HAPTIC_AUTOCENTER
 Device can set autocenter. More...
 
constexpr HapticEffectType SDL::HAPTIC_STATUS = SDL_HAPTIC_STATUS
 Device can be queried for effect status. More...
 
constexpr HapticEffectType SDL::HAPTIC_PAUSE = SDL_HAPTIC_PAUSE
 Device can be paused. More...
 

Direction encodings

using SDL::HapticDirectionType = Uint8
 Direction encoding.
 
constexpr HapticDirectionType SDL::HAPTIC_POLAR = SDL_HAPTIC_POLAR
 Uses polar coordinates for the direction. More...
 
constexpr HapticDirectionType SDL::HAPTIC_CARTESIAN = SDL_HAPTIC_CARTESIAN
 Uses cartesian coordinates for the direction. More...
 
constexpr HapticDirectionType SDL::HAPTIC_SPHERICAL = SDL_HAPTIC_SPHERICAL
 Uses spherical coordinates for the direction. More...
 
constexpr HapticDirectionType SDL::HAPTIC_STEERING_AXIS = SDL_HAPTIC_STEERING_AXIS
 Use this value to play an effect on the steering wheel axis. More...
 

Detailed Description

The basic usage is as follows:

Simple rumble example:

Haptic *haptic = nullptr;
// Open the device
HapticID *haptics = GetHaptics(nullptr);
if (haptics) {
haptic = Haptic.Haptic(haptics[0]);
free(haptics);
}
if (haptic == nullptr)
return;
// Initialize simple rumble
if (!Haptic.InitRumble(haptic))
return;
// Play effect at 50% strength for 2 seconds
if (!Haptic.PlayRumble(haptic, 0.5, 2000))
return;
Delay(2000);
// Clean up
Haptic.Close(haptic);
SDL_HapticID HapticID
This is a unique ID for a haptic device for the time it is connected to the system,...
Definition: SDL3pp_haptic.h:775
OwnArray< HapticID > GetHaptics()
Get a list of currently connected haptic devices.
Definition: SDL3pp_haptic.h:1288
void free(void *mem)
Free allocated memory.
Definition: SDL3pp_stdinc.h:722
void Delay(std::chrono::nanoseconds duration)
Wait a specified duration before returning.
Definition: SDL3pp_timer.h:102

Complete example:

bool test_haptic(Joystick *joystick)
{
Haptic *haptic;
HapticEffect effect;
int effect_id;
// Open the device
haptic = Haptic.Haptic(joystick);
if (haptic == nullptr) return false; // Most likely joystick isn't haptic
// See if it can do sine waves
if ((Haptic.GetFeatures(haptic) & HAPTIC_SINE)==0) {
Haptic.Close(haptic); // No sine effect
return false;
}
// Create the effect
memset(&effect, 0, sizeof(HapticEffect)); // 0 is safe default
effect.type = HAPTIC_SINE;
effect.periodic.direction.type = HAPTIC_POLAR; // Polar coordinates
effect.periodic.direction.dir[0] = 18000; // Force comes from south
effect.periodic.period = 1000; // 1000 ms
effect.periodic.magnitude = 20000; // 20000/32767 strength
effect.periodic.length = 5000; // 5 seconds long
effect.periodic.attack_length = 1000; // Takes 1 second to get max
strength effect.periodic.fade_length = 1000; // Takes 1 second to fade away
// Upload the effect
effect_id = Haptic.CreateEffect(haptic, &effect);
// Test the effect
Haptic.RunEffect(haptic, effect_id, 1);
Delay(5000); // Wait for the effect to finish
// We destroy the effect, although closing the device also does this
Haptic.DestroyEffect(haptic, effect_id);
// Close the device
Haptic.Close(haptic);
return true; // Success
}
constexpr HapticEffectType HAPTIC_SINE
Sine wave effect supported.
Definition: SDL3pp_haptic.h:174
constexpr HapticDirectionType HAPTIC_POLAR
Uses polar coordinates for the direction.
Definition: SDL3pp_haptic.h:382
SDL_HapticEffect HapticEffect
The generic template for any haptic effect.
Definition: SDL3pp_haptic.h:763
void * memset(void *dst, int c, size_t len)
Initialize all bytes of buffer of memory to a specific value.
Definition: SDL3pp_stdinc.h:2421

Note that the SDL haptic subsystem is not thread-safe.

Typedef Documentation

◆ HapticCondition

using SDL::HapticCondition = typedef SDL_HapticCondition

The struct handles the following effects:

  • HAPTIC_SPRING: Effect based on axes position.
  • HAPTIC_DAMPER: Effect based on axes velocity.
  • HAPTIC_INERTIA: Effect based on axes acceleration.
  • HAPTIC_FRICTION: Effect based on axes movement.

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.

Since
This struct is available since SDL 3.2.0.
See also
HapticDirection
HAPTIC_SPRING
HAPTIC_DAMPER
HAPTIC_INERTIA
HAPTIC_FRICTION
HapticEffect

◆ HapticConstant

using SDL::HapticConstant = typedef SDL_HapticConstant

This struct is exclusively for the HAPTIC_CONSTANT effect.

A constant effect applies a constant force in the specified direction to the joystick.

Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_CONSTANT
HapticEffect

◆ HapticCustom

using SDL::HapticCustom = typedef SDL_HapticCustom

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.

Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_CUSTOM
HapticEffect

◆ HapticDirection

using SDL::HapticDirection = typedef SDL_HapticDirection

This is the direction where the force comes from, instead of the direction in which the force is exerted.

Directions can be specified by:

  • HAPTIC_POLAR : Specified by polar coordinates.
  • HAPTIC_CARTESIAN : Specified by cartesian coordinates.
  • HAPTIC_SPHERICAL : Specified by spherical coordinates.

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:

.--.
|__| .-------.
|=.| |.-----.|
|--| || ||
| | |'-----'|
|__|~')_____('
[ COMPUTER ]
North (0,-1)
^
|
|
(-1,0) West <----[ HAPTIC ]----> East (1,0)
|
|
v
South (0,1)
[ USER ]
\|||/
(o o)
---ooO-(_)-Ooo---

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:

  • North: 0 (0 degrees)
  • East: 9000 (90 degrees)
  • South: 18000 (180 degrees)
  • West: 27000 (270 degrees)

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:

  • North: 0,-1, 0
  • East: 1, 0, 0
  • South: 0, 1, 0
  • West: -1, 0, 0

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):

  • Degrees from (1, 0) rotated towards (0, 1).
  • Degrees towards (0, 0, 1) (device needs at least 3 axes).

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):

HapticDirection direction;
// Cartesian directions
direction.type = HAPTIC_CARTESIAN; // Using cartesian direction encoding.
direction.dir[0] = 0; // X position
direction.dir[1] = 1; // Y position
// Assuming the device has 2 axes, we don't need to specify third parameter.
// Polar directions
direction.type = HAPTIC_POLAR; // We'll be using polar direction encoding.
direction.dir[0] = 18000; // Polar only uses first parameter
// Spherical coordinates
direction.type = HAPTIC_SPHERICAL; // Spherical encoding
direction.dir[0] = 9000; // Since we only have two axes we don't need more
parameters.
SDL_HapticDirection HapticDirection
Structure that represents a haptic direction.
Definition: SDL3pp_haptic.h:529
constexpr HapticDirectionType HAPTIC_SPHERICAL
Uses spherical coordinates for the direction.
Definition: SDL3pp_haptic.h:400
constexpr HapticDirectionType HAPTIC_CARTESIAN
Uses cartesian coordinates for the direction.
Definition: SDL3pp_haptic.h:391
Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_POLAR
HAPTIC_CARTESIAN
HAPTIC_SPHERICAL
HAPTIC_STEERING_AXIS
HapticEffect
Haptic.GetNumAxes

◆ HapticEffect

using SDL::HapticEffect = typedef SDL_HapticEffect

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:

// 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.
Uint16 Uint16
An unsigned 16-bit integer type.
Definition: SDL3pp_stdinc.h:291
Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:325

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
SDL times are signed, 64-bit integers representing nanoseconds since the Unix epoch (Jan 1,...
Definition: SDL3pp_stdinc.h:408

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

Since
This struct is available since SDL 3.2.0.
See also
HapticConstant
HapticPeriodic
HapticCondition
HapticRamp
HapticLeftRight
HapticCustom

◆ HapticEffectType

using SDL::HapticEffectType = typedef Uint32

◆ HapticID

using SDL::HapticID = typedef SDL_HapticID

If the haptic device is disconnected and reconnected, it will get a new ID.

The value 0 is an invalid ID.

Since
This datatype is available since SDL 3.2.0.

◆ HapticLeftRight

using SDL::HapticLeftRight = typedef SDL_HapticLeftRight

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.

Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_LEFTRIGHT
HapticEffect

◆ HapticPeriodic

using SDL::HapticPeriodic = typedef SDL_HapticPeriodic

The struct handles the following effects:

  • HAPTIC_SINE
  • HAPTIC_SQUARE
  • HAPTIC_TRIANGLE
  • HAPTIC_SAWTOOTHUP
  • HAPTIC_SAWTOOTHDOWN

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:

  • 0: No phase displacement.
  • 9000: Displaced 25% of its period.
  • 18000: Displaced 50% of its period.
  • 27000: Displaced 75% of its period.
  • 36000: Displaced 100% of its period, same as 0, but 0 is preferred.

Examples:

__ __ __ __
/ \ / \ / \ /
/ @__/ @__/ @__/
__ __ __ __ __
| | | | | | | | | |
| |__| |__| |__| |__| |
/\ /\ /\ /\ /\
/ \ / \ / \ / \ /
/ \/ \/ \/ \/
/| /| /| /| /| /| /|
/ | / | / | / | / | / | / |
/ |/ |/ |/ |/ |/ |/ |
\ |\ |\ |\ |\ |\ |\ |
\ | \ | \ | \ | \ | \ | \ |
\| \| \| \| \| \| \|
constexpr HapticEffectType HAPTIC_SQUARE
Square wave effect supported.
Definition: SDL3pp_haptic.h:185
constexpr HapticEffectType HAPTIC_TRIANGLE
Triangle wave effect supported.
Definition: SDL3pp_haptic.h:196
constexpr HapticEffectType HAPTIC_SAWTOOTHDOWN
Sawtoothdown wave effect supported.
Definition: SDL3pp_haptic.h:218
constexpr HapticEffectType HAPTIC_SAWTOOTHUP
Sawtoothup wave effect supported.
Definition: SDL3pp_haptic.h:207
Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_SINE
HAPTIC_SQUARE
HAPTIC_TRIANGLE
HAPTIC_SAWTOOTHUP
HAPTIC_SAWTOOTHDOWN
HapticEffect

◆ HapticRamp

using SDL::HapticRamp = typedef SDL_HapticRamp

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.

Since
This struct is available since SDL 3.2.0.
See also
HAPTIC_RAMP
HapticEffect

Function Documentation

◆ Close()

void SDL::Haptic::Close ( )
inline
Since
This function is available since SDL 3.2.0.
See also
Haptic.Haptic

◆ CloseHaptic()

void SDL::CloseHaptic ( HapticRaw  haptic)
inline
Parameters
hapticthe Haptic device to close.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Haptic

◆ CreateEffect()

int SDL::Haptic::CreateEffect ( const HapticEffect effect)
inline
Parameters
effectan HapticEffect structure containing the properties of the effect to create.
Returns
the ID of the effect on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.DestroyEffect
Haptic.RunEffect
Haptic.UpdateEffect

◆ CreateHapticEffect()

int SDL::CreateHapticEffect ( HapticParam  haptic,
const HapticEffect effect 
)
inline
Parameters
haptican Haptic device to create the effect on.
effectan HapticEffect structure containing the properties of the effect to create.
Returns
the ID of the effect on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.DestroyEffect
Haptic.RunEffect
Haptic.UpdateEffect

◆ DestroyEffect()

void SDL::Haptic::DestroyEffect ( int  effect)
inline

This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.

Parameters
effectthe ID of the haptic effect to destroy.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect

◆ DestroyHapticEffect()

void SDL::DestroyHapticEffect ( HapticParam  haptic,
int  effect 
)
inline

This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.

Parameters
hapticthe Haptic device to destroy the effect on.
effectthe ID of the haptic effect to destroy.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect

◆ EffectSupported()

bool SDL::Haptic::EffectSupported ( const HapticEffect effect)
inline
Parameters
effectthe desired effect to query.
Returns
true if the effect is supported or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect
Haptic.GetFeatures

◆ GetEffectStatus()

bool SDL::Haptic::GetEffectStatus ( int  effect)
inline

Device must support the HAPTIC_STATUS feature.

Parameters
effectthe ID of the haptic effect to query its status.
Returns
true if it is playing, false if it isn't playing or haptic status isn't supported.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ GetFeatures()

Uint32 SDL::Haptic::GetFeatures ( )
inline
Returns
a list of supported haptic features in bitwise manner (OR'd), or 0 on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.EffectSupported
Haptic.GetMaxEffects

◆ GetHapticEffectStatus()

bool SDL::GetHapticEffectStatus ( HapticParam  haptic,
int  effect 
)
inline

Device must support the HAPTIC_STATUS feature.

Parameters
hapticthe Haptic device to query for the effect status on.
effectthe ID of the haptic effect to query its status.
Returns
true if it is playing, false if it isn't playing or haptic status isn't supported.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ GetHapticFeatures()

Uint32 SDL::GetHapticFeatures ( HapticParam  haptic)
inline
Parameters
hapticthe Haptic device to query.
Returns
a list of supported haptic features in bitwise manner (OR'd), or 0 on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.EffectSupported
Haptic.GetMaxEffects

◆ GetHapticFromID()

HapticRef SDL::GetHapticFromID ( HapticID  instance_id)
inline
Parameters
instance_idthe instance ID to get the Haptic for.
Returns
an Haptic on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.

◆ GetHapticID()

HapticID SDL::GetHapticID ( HapticParam  haptic)
inline
Parameters
hapticthe Haptic device to query.
Returns
the instance ID of the specified haptic device on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.

◆ GetHapticName()

const char * SDL::GetHapticName ( HapticParam  haptic)
inline
Parameters
hapticthe Haptic obtained from JoystickID.OpenJoystick().
Returns
the name of the selected haptic device. If no name can be found, this function returns nullptr; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
GetHapticNameForID

◆ GetHapticNameForID()

const char * SDL::GetHapticNameForID ( HapticID  instance_id)
inline

This can be called before any haptic devices are opened.

Parameters
instance_idthe haptic device instance ID.
Returns
the name of the selected haptic device. If no name can be found, this function returns nullptr; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetName
Haptic.Haptic

◆ GetHaptics()

OwnArray< HapticID > SDL::GetHaptics ( )
inline
Returns
a 0 terminated array of haptic device instance IDs or nullptr on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Haptic

◆ GetID()

HapticID SDL::Haptic::GetID ( )
inline
Returns
the instance ID of the specified haptic device on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.

◆ GetMaxEffects()

int SDL::Haptic::GetMaxEffects ( )
inline

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().

Returns
the number of effects the haptic device can store or a negative error code on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetMaxEffectsPlaying
Haptic.GetFeatures

◆ GetMaxEffectsPlaying()

int SDL::Haptic::GetMaxEffectsPlaying ( )
inline

This is not supported on all platforms, but will always return a value.

Returns
the number of effects the haptic device can play at the same time or -1 on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetMaxEffects
Haptic.GetFeatures

◆ GetMaxHapticEffects()

int SDL::GetMaxHapticEffects ( HapticParam  haptic)
inline

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().

Parameters
hapticthe Haptic device to query.
Returns
the number of effects the haptic device can store or a negative error code on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetMaxEffectsPlaying
Haptic.GetFeatures

◆ GetMaxHapticEffectsPlaying()

int SDL::GetMaxHapticEffectsPlaying ( HapticParam  haptic)
inline

This is not supported on all platforms, but will always return a value.

Parameters
hapticthe Haptic device to query maximum playing effects.
Returns
the number of effects the haptic device can play at the same time or -1 on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetMaxEffects
Haptic.GetFeatures

◆ GetName()

const char * SDL::Haptic::GetName ( )
inline
Returns
the name of the selected haptic device. If no name can be found, this function returns nullptr; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
GetHapticNameForID

◆ GetNumAxes()

int SDL::Haptic::GetNumAxes ( )
inline

The number of haptic axes might be useful if working with the HapticDirection effect.

Returns
the number of axes on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.

◆ GetNumHapticAxes()

int SDL::GetNumHapticAxes ( HapticParam  haptic)
inline

The number of haptic axes might be useful if working with the HapticDirection effect.

Parameters
hapticthe Haptic device to query.
Returns
the number of axes on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.

◆ HapticEffectSupported()

bool SDL::HapticEffectSupported ( HapticParam  haptic,
const HapticEffect effect 
)
inline
Parameters
hapticthe Haptic device to query.
effectthe desired effect to query.
Returns
true if the effect is supported or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect
Haptic.GetFeatures

◆ HapticRumbleSupported()

bool SDL::HapticRumbleSupported ( HapticParam  haptic)
inline
Parameters
haptichaptic device to check for rumble support.
Returns
true if the effect is supported or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.InitRumble

◆ InitHapticRumble()

void SDL::InitHapticRumble ( HapticParam  haptic)
inline
Parameters
hapticthe haptic device to initialize for simple rumble playback.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.PlayRumble
Haptic.StopRumble
Haptic.RumbleSupported

◆ InitRumble()

void SDL::Haptic::InitRumble ( )
inline
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.PlayRumble
Haptic.StopRumble
Haptic.RumbleSupported

◆ IsJoystickHaptic()

bool SDL::IsJoystickHaptic ( JoystickParam  joystick)
inline
Parameters
joystickthe Joystick to test for haptic capabilities.
Returns
true if the joystick is haptic or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Haptic

◆ IsMouseHaptic()

bool SDL::IsMouseHaptic ( )
inline
Returns
true if the mouse is haptic or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.OpenFromMouse

◆ OpenFromMouse()

Haptic SDL::Haptic::OpenFromMouse ( )
inlinestatic
Returns
the haptic device identifier or nullptr on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Close
IsMouseHaptic

◆ OpenHaptic()

Haptic SDL::OpenHaptic ( HapticID  instance_id)
inline

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().

Parameters
instance_idthe haptic device instance ID.
Returns
the device identifier or nullptr on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Close
GetHaptics
Haptic.Haptic
Haptic.OpenFromMouse
Haptic.SetAutocenter
Haptic.SetGain

◆ OpenHapticFromJoystick()

Haptic SDL::OpenHapticFromJoystick ( JoystickParam  joystick)
inline

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.

Parameters
joystickthe Joystick to create a haptic device from.
Returns
a valid haptic device identifier on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Close
IsJoystickHaptic

◆ OpenHapticFromMouse()

Haptic SDL::OpenHapticFromMouse ( )
inline
Returns
the haptic device identifier or nullptr on failure; call GetError() for more information.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Close
IsMouseHaptic

◆ Pause()

void SDL::Haptic::Pause ( )
inline

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.

Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Resume

◆ PauseHaptic()

void SDL::PauseHaptic ( HapticParam  haptic)
inline

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.

Parameters
hapticthe Haptic device to pause.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Resume

◆ PlayHapticRumble()

void SDL::PlayHapticRumble ( HapticParam  haptic,
float  strength,
Uint32  length 
)
inline
Parameters
hapticthe haptic device to play the rumble effect on.
strengthstrength of the rumble to play as a 0-1 float value.
lengthlength of the rumble to play in milliseconds.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.InitRumble
Haptic.StopRumble

◆ PlayRumble()

void SDL::Haptic::PlayRumble ( float  strength,
Uint32  length 
)
inline
Parameters
strengthstrength of the rumble to play as a 0-1 float value.
lengthlength of the rumble to play in milliseconds.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.InitRumble
Haptic.StopRumble

◆ Resume()

void SDL::Haptic::Resume ( )
inline

Call to unpause after Haptic.Pause().

Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Pause

◆ ResumeHaptic()

void SDL::ResumeHaptic ( HapticParam  haptic)
inline

Call to unpause after Haptic.Pause().

Parameters
hapticthe Haptic device to unpause.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.Pause

◆ RumbleSupported()

bool SDL::Haptic::RumbleSupported ( )
inline
Returns
true if the effect is supported or false if it isn't.
Since
This function is available since SDL 3.2.0.
See also
Haptic.InitRumble

◆ RunEffect()

void SDL::Haptic::RunEffect ( int  effect,
Uint32  iterations 
)
inline

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.

Parameters
effectthe ID of the haptic effect to run.
iterationsthe number of iterations to run the effect; use HAPTIC_INFINITY to repeat forever.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetEffectStatus
Haptic.StopEffect
Haptic.StopEffects

◆ RunHapticEffect()

void SDL::RunHapticEffect ( HapticParam  haptic,
int  effect,
Uint32  iterations 
)
inline

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.

Parameters
hapticthe Haptic device to run the effect on.
effectthe ID of the haptic effect to run.
iterationsthe number of iterations to run the effect; use HAPTIC_INFINITY to repeat forever.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetEffectStatus
Haptic.StopEffect
Haptic.StopEffects

◆ SetAutocenter()

void SDL::Haptic::SetAutocenter ( int  autocenter)
inline

Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.

Device must support the HAPTIC_AUTOCENTER feature.

Parameters
autocentervalue to set autocenter to (0-100).
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ SetGain()

void SDL::Haptic::SetGain ( int  gain)
inline

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.

Parameters
gainvalue to set the gain to, should be between 0 and 100 (0 - 100).
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ SetHapticAutocenter()

void SDL::SetHapticAutocenter ( HapticParam  haptic,
int  autocenter 
)
inline

Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.

Device must support the HAPTIC_AUTOCENTER feature.

Parameters
hapticthe Haptic device to set autocentering on.
autocentervalue to set autocenter to (0-100).
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ SetHapticGain()

void SDL::SetHapticGain ( HapticParam  haptic,
int  gain 
)
inline

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.

Parameters
hapticthe Haptic device to set the gain on.
gainvalue to set the gain to, should be between 0 and 100 (0 - 100).
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.GetFeatures

◆ StopEffect()

void SDL::Haptic::StopEffect ( int  effect)
inline
Parameters
effectthe ID of the haptic effect to stop.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.RunEffect
Haptic.StopEffects

◆ StopEffects()

void SDL::Haptic::StopEffects ( )
inline
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.RunEffect
Haptic.StopEffects

◆ StopHapticEffect()

void SDL::StopHapticEffect ( HapticParam  haptic,
int  effect 
)
inline
Parameters
hapticthe Haptic device to stop the effect on.
effectthe ID of the haptic effect to stop.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.RunEffect
Haptic.StopEffects

◆ StopHapticEffects()

void SDL::StopHapticEffects ( HapticParam  haptic)
inline
Parameters
hapticthe Haptic device to stop.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.RunEffect
Haptic.StopEffects

◆ StopHapticRumble()

void SDL::StopHapticRumble ( HapticParam  haptic)
inline
Parameters
hapticthe haptic device to stop the rumble effect on.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.PlayRumble

◆ StopRumble()

void SDL::Haptic::StopRumble ( )
inline
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.PlayRumble

◆ UpdateEffect()

void SDL::Haptic::UpdateEffect ( int  effect,
const HapticEffect data 
)
inline

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().

Parameters
effectthe identifier of the effect to update.
dataan HapticEffect structure containing the new effect properties to use.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect
Haptic.RunEffect

◆ UpdateHapticEffect()

void SDL::UpdateHapticEffect ( HapticParam  haptic,
int  effect,
const HapticEffect data 
)
inline

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().

Parameters
hapticthe Haptic device that has the effect.
effectthe identifier of the effect to update.
dataan HapticEffect structure containing the new effect properties to use.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
Haptic.CreateEffect
Haptic.RunEffect

Variable Documentation

◆ HAPTIC_AUTOCENTER

constexpr HapticEffectType SDL::HAPTIC_AUTOCENTER = SDL_HAPTIC_AUTOCENTER
constexpr

Device supports setting autocenter.

Since
This constant is available since SDL 3.2.0.
See also
Haptic.SetAutocenter

◆ HAPTIC_CARTESIAN

constexpr HapticDirectionType SDL::HAPTIC_CARTESIAN = SDL_HAPTIC_CARTESIAN
constexpr
Since
This constant is available since SDL 3.2.0.
See also
HapticDirection

◆ HAPTIC_CONSTANT

constexpr HapticEffectType SDL::HAPTIC_CONSTANT = SDL_HAPTIC_CONSTANT
constexpr

Constant haptic effect.

Since
This constant is available since SDL 3.2.0.
See also
HapticCondition

◆ HAPTIC_CUSTOM

constexpr HapticEffectType SDL::HAPTIC_CUSTOM = SDL_HAPTIC_CUSTOM
constexpr

User defined custom haptic effect.

Since
This constant is available since SDL 3.2.0.

◆ HAPTIC_DAMPER

constexpr HapticEffectType SDL::HAPTIC_DAMPER = SDL_HAPTIC_DAMPER
constexpr

Condition haptic effect that simulates dampening. Effect is based on the axes velocity.

Since
This constant is available since SDL 3.2.0.
See also
HapticCondition

◆ HAPTIC_FRICTION

constexpr HapticEffectType SDL::HAPTIC_FRICTION = SDL_HAPTIC_FRICTION
constexpr

Condition haptic effect that simulates friction. Effect is based on the axes movement.

Since
This constant is available since SDL 3.2.0.
See also
HapticCondition

◆ HAPTIC_GAIN

constexpr HapticEffectType SDL::HAPTIC_GAIN = SDL_HAPTIC_GAIN
constexpr

Device supports setting the global gain.

Since
This constant is available since SDL 3.2.0.
See also
Haptic.SetGain

◆ HAPTIC_INERTIA

constexpr HapticEffectType SDL::HAPTIC_INERTIA = SDL_HAPTIC_INERTIA
constexpr

Condition haptic effect that simulates inertia. Effect is based on the axes acceleration.

Since
This constant is available since SDL 3.2.0.
See also
HapticCondition

◆ HAPTIC_INFINITY

constexpr Uint32 SDL::HAPTIC_INFINITY = SDL_HAPTIC_INFINITY
constexpr
Since
This constant is available since SDL 3.2.0.
See also
Haptic.RunEffect

◆ HAPTIC_LEFTRIGHT

constexpr HapticEffectType SDL::HAPTIC_LEFTRIGHT = SDL_HAPTIC_LEFTRIGHT
constexpr

Haptic effect for direct control over high/low frequency motors.

Since
This constant is available since SDL 3.2.0.
See also
HapticLeftRight

◆ HAPTIC_PAUSE

constexpr HapticEffectType SDL::HAPTIC_PAUSE = SDL_HAPTIC_PAUSE
constexpr

Devices supports being paused.

Since
This constant is available since SDL 3.2.0.
See also
Haptic.Pause
Haptic.Resume

◆ HAPTIC_POLAR

constexpr HapticDirectionType SDL::HAPTIC_POLAR = SDL_HAPTIC_POLAR
constexpr
Since
This constant is available since SDL 3.2.0.
See also
HapticDirection

◆ HAPTIC_RAMP

constexpr HapticEffectType SDL::HAPTIC_RAMP = SDL_HAPTIC_RAMP
constexpr

Ramp haptic effect.

Since
This constant is available since SDL 3.2.0.
See also
HapticRamp

◆ HAPTIC_RESERVED1

constexpr HapticEffectType SDL::HAPTIC_RESERVED1 = SDL_HAPTIC_RESERVED1
constexpr
Since
This constant is available since SDL 3.2.0.

◆ HAPTIC_RESERVED2

constexpr HapticEffectType SDL::HAPTIC_RESERVED2 = SDL_HAPTIC_RESERVED2
constexpr
Since
This constant is available since SDL 3.2.0.

◆ HAPTIC_RESERVED3

constexpr HapticEffectType SDL::HAPTIC_RESERVED3 = SDL_HAPTIC_RESERVED3
constexpr
Since
This constant is available since SDL 3.2.0.

◆ HAPTIC_SAWTOOTHDOWN

constexpr HapticEffectType SDL::HAPTIC_SAWTOOTHDOWN = SDL_HAPTIC_SAWTOOTHDOWN
constexpr

Periodic haptic effect that simulates saw tooth down waves.

Since
This constant is available since SDL 3.2.0.
See also
HapticPeriodic

◆ HAPTIC_SAWTOOTHUP

constexpr HapticEffectType SDL::HAPTIC_SAWTOOTHUP = SDL_HAPTIC_SAWTOOTHUP
constexpr

Periodic haptic effect that simulates saw tooth up waves.

Since
This constant is available since SDL 3.2.0.
See also
HapticPeriodic

◆ HAPTIC_SINE

constexpr HapticEffectType SDL::HAPTIC_SINE = SDL_HAPTIC_SINE
constexpr

Periodic haptic effect that simulates sine waves.

Since
This constant is available since SDL 3.2.0.
See also
HapticPeriodic

◆ HAPTIC_SPHERICAL

constexpr HapticDirectionType SDL::HAPTIC_SPHERICAL = SDL_HAPTIC_SPHERICAL
constexpr
Since
This constant is available since SDL 3.2.0.
See also
HapticDirection

◆ HAPTIC_SPRING

constexpr HapticEffectType SDL::HAPTIC_SPRING = SDL_HAPTIC_SPRING
constexpr

Condition haptic effect that simulates a spring. Effect is based on the axes position.

Since
This constant is available since SDL 3.2.0.
See also
HapticCondition

◆ HAPTIC_SQUARE

constexpr HapticEffectType SDL::HAPTIC_SQUARE = SDL_HAPTIC_SQUARE
constexpr

Periodic haptic effect that simulates square waves.

Since
This constant is available since SDL 3.2.0.
See also
HapticPeriodic

◆ HAPTIC_STATUS

constexpr HapticEffectType SDL::HAPTIC_STATUS = SDL_HAPTIC_STATUS
constexpr

Device supports querying effect status.

Since
This constant is available since SDL 3.2.0.
See also
Haptic.GetEffectStatus

◆ HAPTIC_STEERING_AXIS

constexpr HapticDirectionType SDL::HAPTIC_STEERING_AXIS = SDL_HAPTIC_STEERING_AXIS
constexpr

This provides better compatibility across platforms and devices as SDL will guess the correct axis.

Since
This constant is available since SDL 3.2.0.
See also
HapticDirection

◆ HAPTIC_TRIANGLE

constexpr HapticEffectType SDL::HAPTIC_TRIANGLE = SDL_HAPTIC_TRIANGLE
constexpr

Periodic haptic effect that simulates triangular waves.

Since
This constant is available since SDL 3.2.0.
See also
HapticPeriodic