SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_haptic.h
1#ifndef SDL3PP_HAPTIC_H_
2#define SDL3PP_HAPTIC_H_
3
4#include <SDL3/SDL_haptic.h>
5#include "SDL3pp_error.h"
6#include "SDL3pp_joystick.h"
7#include "SDL3pp_stdinc.h"
8
9namespace SDL {
10
107// Forward decl
108struct Haptic;
109
111using HapticRaw = SDL_Haptic*;
112
113// Forward decl
114struct HapticRef;
115
118{
120
123 : value(value)
124 {
125 }
126
128 constexpr HapticParam(std::nullptr_t = nullptr)
129 : value(nullptr)
130 {
131 }
132
134 constexpr explicit operator bool() const { return !!value; }
135
137 constexpr auto operator<=>(const HapticParam& other) const = default;
138
140 constexpr operator HapticRaw() const { return value; }
141};
142
155using HapticEffectID = int;
156
159
169constexpr HapticEffectType HAPTIC_CONSTANT = SDL_HAPTIC_CONSTANT;
170
180constexpr HapticEffectType HAPTIC_SINE = SDL_HAPTIC_SINE;
181
191constexpr HapticEffectType HAPTIC_SQUARE = SDL_HAPTIC_SQUARE;
192
202constexpr HapticEffectType HAPTIC_TRIANGLE = SDL_HAPTIC_TRIANGLE;
203
213constexpr HapticEffectType HAPTIC_SAWTOOTHUP = SDL_HAPTIC_SAWTOOTHUP;
214
224constexpr HapticEffectType HAPTIC_SAWTOOTHDOWN = SDL_HAPTIC_SAWTOOTHDOWN;
225
235constexpr HapticEffectType HAPTIC_RAMP = SDL_HAPTIC_RAMP;
236
247constexpr HapticEffectType HAPTIC_SPRING = SDL_HAPTIC_SPRING;
248
259constexpr HapticEffectType HAPTIC_DAMPER = SDL_HAPTIC_DAMPER;
260
271constexpr HapticEffectType HAPTIC_INERTIA = SDL_HAPTIC_INERTIA;
272
283constexpr HapticEffectType HAPTIC_FRICTION = SDL_HAPTIC_FRICTION;
284
294constexpr HapticEffectType HAPTIC_LEFTRIGHT = SDL_HAPTIC_LEFTRIGHT;
295
301constexpr HapticEffectType HAPTIC_RESERVED1 = SDL_HAPTIC_RESERVED1;
302
308constexpr HapticEffectType HAPTIC_RESERVED2 = SDL_HAPTIC_RESERVED2;
309
315constexpr HapticEffectType HAPTIC_RESERVED3 = SDL_HAPTIC_RESERVED3;
316
324constexpr HapticEffectType HAPTIC_CUSTOM = SDL_HAPTIC_CUSTOM;
325
335constexpr HapticEffectType HAPTIC_GAIN = SDL_HAPTIC_GAIN;
336
346constexpr HapticEffectType HAPTIC_AUTOCENTER = SDL_HAPTIC_AUTOCENTER;
347
357constexpr HapticEffectType HAPTIC_STATUS = SDL_HAPTIC_STATUS;
358
369constexpr HapticEffectType HAPTIC_PAUSE = SDL_HAPTIC_PAUSE;
370
372
380
388constexpr HapticDirectionType HAPTIC_POLAR = SDL_HAPTIC_POLAR;
389
397constexpr HapticDirectionType HAPTIC_CARTESIAN = SDL_HAPTIC_CARTESIAN;
398
406constexpr HapticDirectionType HAPTIC_SPHERICAL = SDL_HAPTIC_SPHERICAL;
407
418constexpr HapticDirectionType HAPTIC_STEERING_AXIS = SDL_HAPTIC_STEERING_AXIS;
419
421
429constexpr Uint32 HAPTIC_INFINITY = SDL_HAPTIC_INFINITY;
430
535using HapticDirection = SDL_HapticDirection;
536
550using HapticConstant = SDL_HapticConstant;
551
614using HapticPeriodic = SDL_HapticPeriodic;
615
642using HapticCondition = SDL_HapticCondition;
643
659using HapticRamp = SDL_HapticRamp;
660
675using HapticLeftRight = SDL_HapticLeftRight;
676
694using HapticCustom = SDL_HapticCustom;
695
768using HapticEffect = SDL_HapticEffect;
769
780using HapticID = SDL_HapticID;
781
794{
795 HapticRaw m_resource = nullptr;
796
797public:
799 constexpr Haptic(std::nullptr_t = nullptr) noexcept
800 : m_resource(0)
801 {
802 }
803
811 constexpr explicit Haptic(const HapticRaw resource) noexcept
812 : m_resource(resource)
813 {
814 }
815
816protected:
818 constexpr Haptic(const Haptic& other) noexcept = default;
819
820public:
822 constexpr Haptic(Haptic&& other) noexcept
823 : Haptic(other.release())
824 {
825 }
826
827 constexpr Haptic(const HapticRef& other) = delete;
828
829 constexpr Haptic(HapticRef&& other) = delete;
830
854 Haptic(HapticID instance_id)
855 : m_resource(SDL_OpenHaptic(instance_id))
856 {
857 }
858
880 : m_resource(CheckError(SDL_OpenHapticFromJoystick(joystick)))
881 {
882 }
883
895 static Haptic OpenFromMouse();
896
898 ~Haptic() { SDL_CloseHaptic(m_resource); }
899
901 constexpr Haptic& operator=(Haptic&& other) noexcept
902 {
903 std::swap(m_resource, other.m_resource);
904 return *this;
905 }
906
907protected:
909 constexpr Haptic& operator=(const Haptic& other) noexcept = default;
910
911public:
913 constexpr HapticRaw get() const noexcept { return m_resource; }
914
916 constexpr HapticRaw release() noexcept
917 {
918 auto r = m_resource;
919 m_resource = nullptr;
920 return r;
921 }
922
924 constexpr auto operator<=>(const Haptic& other) const noexcept = default;
925
927 constexpr explicit operator bool() const noexcept { return !!m_resource; }
928
930 constexpr operator HapticParam() const noexcept { return {m_resource}; }
931
939 void Close();
940
949 HapticID GetID();
950
962 const char* GetName();
963
979 int GetMaxEffects();
980
995
1008
1020 int GetNumAxes();
1021
1033 bool EffectSupported(const HapticEffect& effect);
1034
1050
1069 void UpdateEffect(HapticEffectID effect, const HapticEffect& data);
1070
1090 void RunEffect(HapticEffectID effect, Uint32 iterations);
1091
1103 void StopEffect(HapticEffectID effect);
1104
1117 void DestroyEffect(HapticEffectID effect);
1118
1132 bool GetEffectStatus(HapticEffectID effect);
1133
1152 void SetGain(int gain);
1153
1169 void SetAutocenter(int autocenter);
1170
1186 void Pause();
1187
1199 void Resume();
1200
1211 void StopEffects();
1212
1222 bool RumbleSupported();
1223
1235 void InitRumble();
1236
1249 void PlayRumble(float strength, Uint32 length);
1250
1260 void StopRumble();
1261};
1262
1265{
1266 using Haptic::Haptic;
1267
1275 HapticRef(HapticParam resource) noexcept
1276 : Haptic(resource.value)
1277 {
1278 }
1279
1287 HapticRef(HapticRaw resource) noexcept
1288 : Haptic(resource)
1289 {
1290 }
1291
1293 constexpr HapticRef(const HapticRef& other) noexcept = default;
1294
1297};
1298
1310{
1311 int count;
1312 auto data = SDL_GetHaptics(&count);
1313 return OwnArray<HapticID>{data};
1314}
1315
1330inline const char* GetHapticNameForID(HapticID instance_id)
1331{
1332 return SDL_GetHapticNameForID(instance_id);
1333}
1334
1358inline Haptic OpenHaptic(HapticID instance_id) { return Haptic(instance_id); }
1359
1370{
1371 return {CheckError(SDL_GetHapticFromID(instance_id))};
1372}
1373
1384{
1385 return CheckError(SDL_GetHapticID(haptic));
1386}
1387
1388inline HapticID Haptic::GetID() { return SDL::GetHapticID(m_resource); }
1389
1401inline const char* GetHapticName(HapticParam haptic)
1402{
1403 return SDL_GetHapticName(haptic);
1404}
1405
1406inline const char* Haptic::GetName() { return SDL::GetHapticName(m_resource); }
1407
1417inline bool IsMouseHaptic() { return SDL_IsMouseHaptic(); }
1418
1431{
1432 return Haptic(SDL_OpenHapticFromMouse());
1433}
1434
1436
1447inline bool IsJoystickHaptic(JoystickParam joystick)
1448{
1449 return SDL_IsJoystickHaptic(joystick);
1450}
1451
1473{
1474 return Haptic(joystick);
1475}
1476
1486inline void CloseHaptic(HapticRaw haptic) { SDL_CloseHaptic(haptic); }
1487
1488inline void Haptic::Close() { CloseHaptic(release()); }
1489
1507{
1508 return SDL_GetMaxHapticEffects(haptic);
1509}
1510
1512{
1513 return SDL::GetMaxHapticEffects(m_resource);
1514}
1515
1531{
1532 return SDL_GetMaxHapticEffectsPlaying(haptic);
1533}
1534
1536{
1537 return SDL::GetMaxHapticEffectsPlaying(m_resource);
1538}
1539
1553{
1554 return SDL_GetHapticFeatures(haptic);
1555}
1556
1558{
1559 return SDL::GetHapticFeatures(m_resource);
1560}
1561
1575{
1576 return CheckError(SDL_GetNumHapticAxes(haptic));
1577}
1578
1579inline int Haptic::GetNumAxes() { return SDL::GetNumHapticAxes(m_resource); }
1580
1594 const HapticEffect& effect)
1595{
1596 return SDL_HapticEffectSupported(haptic, &effect);
1597}
1598
1599inline bool Haptic::EffectSupported(const HapticEffect& effect)
1600{
1601 return SDL::HapticEffectSupported(m_resource, effect);
1602}
1603
1620 const HapticEffect& effect)
1621{
1622 return CheckError(SDL_CreateHapticEffect(haptic, &effect));
1623}
1624
1626{
1627 return SDL::CreateHapticEffect(m_resource, effect);
1628}
1629
1650 HapticEffectID effect,
1651 const HapticEffect& data)
1652{
1653 CheckError(SDL_UpdateHapticEffect(haptic, effect, &data));
1654}
1655
1657 const HapticEffect& data)
1658{
1659 SDL::UpdateHapticEffect(m_resource, effect, data);
1660}
1661
1682inline void RunHapticEffect(HapticParam haptic,
1683 HapticEffectID effect,
1684 Uint32 iterations)
1685{
1686 CheckError(SDL_RunHapticEffect(haptic, effect, iterations));
1687}
1688
1689inline void Haptic::RunEffect(HapticEffectID effect, Uint32 iterations)
1690{
1691 SDL::RunHapticEffect(m_resource, effect, iterations);
1692}
1693
1707{
1708 CheckError(SDL_StopHapticEffect(haptic, effect));
1709}
1710
1712{
1713 SDL::StopHapticEffect(m_resource, effect);
1714}
1715
1730{
1731 SDL_DestroyHapticEffect(haptic, effect);
1732}
1733
1735{
1736 SDL::DestroyHapticEffect(m_resource, effect);
1737}
1738
1754{
1755 return SDL_GetHapticEffectStatus(haptic, effect);
1756}
1757
1759{
1760 return SDL::GetHapticEffectStatus(m_resource, effect);
1761}
1762
1781inline void SetHapticGain(HapticParam haptic, int gain)
1782{
1783 CheckError(SDL_SetHapticGain(haptic, gain));
1784}
1785
1786inline void Haptic::SetGain(int gain) { SDL::SetHapticGain(m_resource, gain); }
1787
1804inline void SetHapticAutocenter(HapticParam haptic, int autocenter)
1805{
1806 CheckError(SDL_SetHapticAutocenter(haptic, autocenter));
1807}
1808
1809inline void Haptic::SetAutocenter(int autocenter)
1810{
1811 SDL::SetHapticAutocenter(m_resource, autocenter);
1812}
1813
1830inline void PauseHaptic(HapticParam haptic)
1831{
1832 CheckError(SDL_PauseHaptic(haptic));
1833}
1834
1835inline void Haptic::Pause() { SDL::PauseHaptic(m_resource); }
1836
1849inline void ResumeHaptic(HapticParam haptic)
1850{
1851 CheckError(SDL_ResumeHaptic(haptic));
1852}
1853
1854inline void Haptic::Resume() { SDL::ResumeHaptic(m_resource); }
1855
1868{
1869 CheckError(SDL_StopHapticEffects(haptic));
1870}
1871
1872inline void Haptic::StopEffects() { SDL::StopHapticEffects(m_resource); }
1873
1885{
1886 return SDL_HapticRumbleSupported(haptic);
1887}
1888
1890{
1891 return SDL::HapticRumbleSupported(m_resource);
1892}
1893
1907{
1908 CheckError(SDL_InitHapticRumble(haptic));
1909}
1910
1911inline void Haptic::InitRumble() { SDL::InitHapticRumble(m_resource); }
1912
1926inline void PlayHapticRumble(HapticParam haptic, float strength, Uint32 length)
1927{
1928 CheckError(SDL_PlayHapticRumble(haptic, strength, length));
1929}
1930
1931inline void Haptic::PlayRumble(float strength, Uint32 length)
1932{
1933 SDL::PlayHapticRumble(m_resource, strength, length);
1934}
1935
1947{
1948 CheckError(SDL_StopHapticRumble(haptic));
1949}
1950
1951inline void Haptic::StopRumble() { SDL::StopHapticRumble(m_resource); }
1952
1954
1955} // namespace SDL
1956
1957#endif /* SDL3PP_HAPTIC_H_ */
The haptic structure used to identify an SDL haptic.
Definition: SDL3pp_haptic.h:794
constexpr auto operator<=>(const Haptic &other) const noexcept=default
Comparison.
constexpr HapticRaw get() const noexcept
Retrieves underlying HapticRaw.
Definition: SDL3pp_haptic.h:913
constexpr Haptic & operator=(Haptic &&other) noexcept
Assignment operator.
Definition: SDL3pp_haptic.h:901
constexpr Haptic(Haptic &&other) noexcept
Move constructor.
Definition: SDL3pp_haptic.h:822
Haptic(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:879
constexpr Haptic(const Haptic &other) noexcept=default
Copy constructor.
~Haptic()
Destructor.
Definition: SDL3pp_haptic.h:898
Haptic(HapticID instance_id)
Open a haptic device for use.
Definition: SDL3pp_haptic.h:854
constexpr Haptic & operator=(const Haptic &other) noexcept=default
Assignment operator.
constexpr HapticRaw release() noexcept
Retrieves underlying HapticRaw and clear this.
Definition: SDL3pp_haptic.h:916
constexpr Haptic(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_haptic.h:799
constexpr Haptic(const HapticRaw resource) noexcept
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:811
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
void StopHapticEffects(HapticParam haptic)
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1867
void RunEffect(HapticEffectID effect, Uint32 iterations)
Run the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1689
constexpr HapticEffectType HAPTIC_FRICTION
Friction effect supported - uses axes movement.
Definition: SDL3pp_haptic.h:283
Haptic OpenHaptic(HapticID instance_id)
Open a haptic device for use.
Definition: SDL3pp_haptic.h:1358
void StopHapticRumble(HapticParam haptic)
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1946
int GetMaxHapticEffectsPlaying(HapticParam haptic)
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1530
void Pause()
Pause a haptic device.
Definition: SDL3pp_haptic.h:1835
void SetHapticAutocenter(HapticParam haptic, int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1804
constexpr HapticEffectType HAPTIC_GAIN
Device can set global gain.
Definition: SDL3pp_haptic.h:335
bool IsJoystickHaptic(JoystickParam joystick)
Query if a joystick has haptic features.
Definition: SDL3pp_haptic.h:1447
void SetGain(int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1786
SDL_HapticDirection HapticDirection
Structure that represents a haptic direction.
Definition: SDL3pp_haptic.h:535
int GetMaxEffectsPlaying()
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1535
HapticID GetHapticID(HapticParam haptic)
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1383
constexpr HapticEffectType HAPTIC_SINE
Sine wave effect supported.
Definition: SDL3pp_haptic.h:180
Haptic OpenHapticFromJoystick(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:1472
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:780
void SetHapticGain(HapticParam haptic, int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1781
constexpr Uint32 HAPTIC_INFINITY
Used to play a device an infinite number of times.
Definition: SDL3pp_haptic.h:429
constexpr HapticEffectType HAPTIC_DAMPER
Damper effect supported - uses axes velocity.
Definition: SDL3pp_haptic.h:259
bool HapticEffectSupported(HapticParam haptic, const HapticEffect &effect)
Check to see if an effect is supported by a haptic device.
Definition: SDL3pp_haptic.h:1593
void StopEffect(HapticEffectID effect)
Stop the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1711
HapticEffectID CreateEffect(const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1625
Uint8 HapticDirectionType
Type of coordinates used for haptic direction.
Definition: SDL3pp_haptic.h:379
void PlayHapticRumble(HapticParam haptic, float strength, Uint32 length)
Run a simple rumble effect on a haptic device.
Definition: SDL3pp_haptic.h:1926
int GetNumHapticAxes(HapticParam haptic)
Get the number of haptic axes the device has.
Definition: SDL3pp_haptic.h:1574
void InitHapticRumble(HapticParam haptic)
Initialize a haptic device for simple rumble playback.
Definition: SDL3pp_haptic.h:1906
void Resume()
Resume a haptic device.
Definition: SDL3pp_haptic.h:1854
constexpr HapticEffectType HAPTIC_RESERVED3
Reserved for future use.
Definition: SDL3pp_haptic.h:315
const char * GetHapticName(HapticParam haptic)
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1401
constexpr HapticEffectType HAPTIC_INERTIA
Inertia effect supported - uses axes acceleration.
Definition: SDL3pp_haptic.h:271
constexpr HapticEffectType HAPTIC_SPRING
Spring effect supported - uses axes position.
Definition: SDL3pp_haptic.h:247
void RunHapticEffect(HapticParam haptic, HapticEffectID effect, Uint32 iterations)
Run the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1682
constexpr HapticEffectType HAPTIC_LEFTRIGHT
Left/Right effect supported.
Definition: SDL3pp_haptic.h:294
SDL_HapticCondition HapticCondition
A structure containing a template for a Condition effect.
Definition: SDL3pp_haptic.h:642
const char * GetHapticNameForID(HapticID instance_id)
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1330
void UpdateHapticEffect(HapticParam haptic, HapticEffectID effect, const HapticEffect &data)
Update the properties of an effect.
Definition: SDL3pp_haptic.h:1649
constexpr HapticEffectType HAPTIC_CUSTOM
Custom effect is supported.
Definition: SDL3pp_haptic.h:324
void InitRumble()
Initialize a haptic device for simple rumble playback.
Definition: SDL3pp_haptic.h:1911
void StopRumble()
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1951
void SetAutocenter(int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1809
Haptic OpenHapticFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1430
constexpr HapticDirectionType HAPTIC_STEERING_AXIS
Use this value to play an effect on the steering wheel axis.
Definition: SDL3pp_haptic.h:418
bool IsMouseHaptic()
Query whether or not the current mouse has haptic capabilities.
Definition: SDL3pp_haptic.h:1417
bool GetEffectStatus(HapticEffectID effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1758
void UpdateEffect(HapticEffectID effect, const HapticEffect &data)
Update the properties of an effect.
Definition: SDL3pp_haptic.h:1656
SDL_HapticConstant HapticConstant
A structure containing a template for a Constant effect.
Definition: SDL3pp_haptic.h:550
int GetNumAxes()
Get the number of haptic axes the device has.
Definition: SDL3pp_haptic.h:1579
SDL_HapticRamp HapticRamp
A structure containing a template for a Ramp effect.
Definition: SDL3pp_haptic.h:659
void PlayRumble(float strength, Uint32 length)
Run a simple rumble effect on a haptic device.
Definition: SDL3pp_haptic.h:1931
bool RumbleSupported()
Check whether rumble is supported on a haptic device.
Definition: SDL3pp_haptic.h:1889
constexpr HapticEffectType HAPTIC_PAUSE
Device can be paused.
Definition: SDL3pp_haptic.h:369
constexpr HapticEffectType HAPTIC_SQUARE
Square wave effect supported.
Definition: SDL3pp_haptic.h:191
SDL_Haptic * HapticRaw
Alias to raw representation for Haptic.
Definition: SDL3pp_haptic.h:111
constexpr HapticEffectType HAPTIC_TRIANGLE
Triangle wave effect supported.
Definition: SDL3pp_haptic.h:202
bool EffectSupported(const HapticEffect &effect)
Check to see if an effect is supported by a haptic device.
Definition: SDL3pp_haptic.h:1599
SDL_HapticPeriodic HapticPeriodic
A structure containing a template for a Periodic effect.
Definition: SDL3pp_haptic.h:614
int HapticEffectID
ID for haptic effects.
Definition: SDL3pp_haptic.h:155
Uint32 GetHapticFeatures(HapticParam haptic)
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1552
constexpr HapticEffectType HAPTIC_RESERVED1
Reserved for future use.
Definition: SDL3pp_haptic.h:301
void CloseHaptic(HapticRaw haptic)
Close a haptic device previously opened with Haptic.Haptic().
Definition: SDL3pp_haptic.h:1486
constexpr HapticDirectionType HAPTIC_SPHERICAL
Uses spherical coordinates for the direction.
Definition: SDL3pp_haptic.h:406
constexpr HapticEffectType HAPTIC_AUTOCENTER
Device can set autocenter.
Definition: SDL3pp_haptic.h:346
void ResumeHaptic(HapticParam haptic)
Resume a haptic device.
Definition: SDL3pp_haptic.h:1849
static Haptic OpenFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1435
HapticID GetID()
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1388
HapticEffectID CreateHapticEffect(HapticParam haptic, const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1619
constexpr HapticEffectType HAPTIC_SAWTOOTHDOWN
Sawtoothdown wave effect supported.
Definition: SDL3pp_haptic.h:224
constexpr HapticDirectionType HAPTIC_CARTESIAN
Uses cartesian coordinates for the direction.
Definition: SDL3pp_haptic.h:397
bool HapticRumbleSupported(HapticParam haptic)
Check whether rumble is supported on a haptic device.
Definition: SDL3pp_haptic.h:1884
int GetMaxEffects()
Get the number of effects a haptic device can store.
Definition: SDL3pp_haptic.h:1511
void StopHapticEffect(HapticParam haptic, HapticEffectID effect)
Stop the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1706
constexpr HapticDirectionType HAPTIC_POLAR
Uses polar coordinates for the direction.
Definition: SDL3pp_haptic.h:388
void DestroyEffect(HapticEffectID effect)
Destroy a haptic effect on the device.
Definition: SDL3pp_haptic.h:1734
constexpr HapticEffectType HAPTIC_CONSTANT
Constant effect supported.
Definition: SDL3pp_haptic.h:169
int GetMaxHapticEffects(HapticParam haptic)
Get the number of effects a haptic device can store.
Definition: SDL3pp_haptic.h:1506
Uint32 HapticEffectType
Type of haptic effect.
Definition: SDL3pp_haptic.h:158
constexpr HapticEffectType HAPTIC_RESERVED2
Reserved for future use.
Definition: SDL3pp_haptic.h:308
HapticRef GetHapticFromID(HapticID instance_id)
Get the Haptic associated with an instance ID, if it has been opened.
Definition: SDL3pp_haptic.h:1369
const char * GetName()
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1406
constexpr HapticEffectType HAPTIC_STATUS
Device can be queried for effect status.
Definition: SDL3pp_haptic.h:357
SDL_HapticCustom HapticCustom
A structure containing a template for the HAPTIC_CUSTOM effect.
Definition: SDL3pp_haptic.h:694
OwnArray< HapticID > GetHaptics()
Get a list of currently connected haptic devices.
Definition: SDL3pp_haptic.h:1309
Uint32 GetFeatures()
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1557
void PauseHaptic(HapticParam haptic)
Pause a haptic device.
Definition: SDL3pp_haptic.h:1830
constexpr HapticEffectType HAPTIC_SAWTOOTHUP
Sawtoothup wave effect supported.
Definition: SDL3pp_haptic.h:213
SDL_HapticEffect HapticEffect
The generic template for any haptic effect.
Definition: SDL3pp_haptic.h:768
void StopEffects()
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1872
SDL_HapticLeftRight HapticLeftRight
A structure containing a template for a Left/Right effect.
Definition: SDL3pp_haptic.h:675
bool GetHapticEffectStatus(HapticParam haptic, HapticEffectID effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1753
constexpr HapticEffectType HAPTIC_RAMP
Ramp effect supported.
Definition: SDL3pp_haptic.h:235
void Close()
Close a haptic device previously opened with Haptic.Haptic().
Definition: SDL3pp_haptic.h:1488
void DestroyHapticEffect(HapticParam haptic, HapticEffectID effect)
Destroy a haptic effect on the device.
Definition: SDL3pp_haptic.h:1729
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
Main include header for the SDL3pp library.
Safely wrap Haptic for non owning parameters.
Definition: SDL3pp_haptic.h:118
constexpr HapticParam(HapticRaw value)
Constructs from HapticRaw.
Definition: SDL3pp_haptic.h:122
constexpr HapticParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_haptic.h:128
constexpr auto operator<=>(const HapticParam &other) const =default
Comparison.
HapticRaw value
parameter's HapticRaw
Definition: SDL3pp_haptic.h:119
Semi-safe reference for Haptic.
Definition: SDL3pp_haptic.h:1265
HapticRef(HapticParam resource) noexcept
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:1275
~HapticRef()
Destructor.
Definition: SDL3pp_haptic.h:1296
HapticRef(HapticRaw resource) noexcept
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:1287
constexpr HapticRef(const HapticRef &other) noexcept=default
Copy constructor.
Safely wrap Joystick for non owning parameters.
Definition: SDL3pp_joystick.h:68