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
153
163constexpr HapticEffectType HAPTIC_CONSTANT = SDL_HAPTIC_CONSTANT;
164
174constexpr HapticEffectType HAPTIC_SINE = SDL_HAPTIC_SINE;
175
185constexpr HapticEffectType HAPTIC_SQUARE = SDL_HAPTIC_SQUARE;
186
196constexpr HapticEffectType HAPTIC_TRIANGLE = SDL_HAPTIC_TRIANGLE;
197
207constexpr HapticEffectType HAPTIC_SAWTOOTHUP = SDL_HAPTIC_SAWTOOTHUP;
208
218constexpr HapticEffectType HAPTIC_SAWTOOTHDOWN = SDL_HAPTIC_SAWTOOTHDOWN;
219
229constexpr HapticEffectType HAPTIC_RAMP = SDL_HAPTIC_RAMP;
230
241constexpr HapticEffectType HAPTIC_SPRING = SDL_HAPTIC_SPRING;
242
253constexpr HapticEffectType HAPTIC_DAMPER = SDL_HAPTIC_DAMPER;
254
265constexpr HapticEffectType HAPTIC_INERTIA = SDL_HAPTIC_INERTIA;
266
277constexpr HapticEffectType HAPTIC_FRICTION = SDL_HAPTIC_FRICTION;
278
288constexpr HapticEffectType HAPTIC_LEFTRIGHT = SDL_HAPTIC_LEFTRIGHT;
289
295constexpr HapticEffectType HAPTIC_RESERVED1 = SDL_HAPTIC_RESERVED1;
296
302constexpr HapticEffectType HAPTIC_RESERVED2 = SDL_HAPTIC_RESERVED2;
303
309constexpr HapticEffectType HAPTIC_RESERVED3 = SDL_HAPTIC_RESERVED3;
310
318constexpr HapticEffectType HAPTIC_CUSTOM = SDL_HAPTIC_CUSTOM;
319
329constexpr HapticEffectType HAPTIC_GAIN = SDL_HAPTIC_GAIN;
330
340constexpr HapticEffectType HAPTIC_AUTOCENTER = SDL_HAPTIC_AUTOCENTER;
341
351constexpr HapticEffectType HAPTIC_STATUS = SDL_HAPTIC_STATUS;
352
363constexpr HapticEffectType HAPTIC_PAUSE = SDL_HAPTIC_PAUSE;
364
366
374
382constexpr HapticDirectionType HAPTIC_POLAR = SDL_HAPTIC_POLAR;
383
391constexpr HapticDirectionType HAPTIC_CARTESIAN = SDL_HAPTIC_CARTESIAN;
392
400constexpr HapticDirectionType HAPTIC_SPHERICAL = SDL_HAPTIC_SPHERICAL;
401
412constexpr HapticDirectionType HAPTIC_STEERING_AXIS = SDL_HAPTIC_STEERING_AXIS;
413
415
423constexpr Uint32 HAPTIC_INFINITY = SDL_HAPTIC_INFINITY;
424
529using HapticDirection = SDL_HapticDirection;
530
544using HapticConstant = SDL_HapticConstant;
545
608using HapticPeriodic = SDL_HapticPeriodic;
609
637using HapticCondition = SDL_HapticCondition;
638
654using HapticRamp = SDL_HapticRamp;
655
670using HapticLeftRight = SDL_HapticLeftRight;
671
689using HapticCustom = SDL_HapticCustom;
690
763using HapticEffect = SDL_HapticEffect;
764
775using HapticID = SDL_HapticID;
776
789{
790 HapticRaw m_resource = nullptr;
791
792public:
794 constexpr Haptic() = default;
795
803 constexpr explicit Haptic(const HapticRaw resource)
804 : m_resource(resource)
805 {
806 }
807
809 constexpr Haptic(const Haptic& other) = delete;
810
812 constexpr Haptic(Haptic&& other)
813 : Haptic(other.release())
814 {
815 }
816
817 constexpr Haptic(const HapticRef& other) = delete;
818
819 constexpr Haptic(HapticRef&& other) = delete;
820
844 Haptic(HapticID instance_id)
845 : m_resource(SDL_OpenHaptic(instance_id))
846 {
847 }
848
870 : m_resource(CheckError(SDL_OpenHapticFromJoystick(joystick)))
871 {
872 }
873
885 static Haptic OpenFromMouse();
886
888 ~Haptic() { SDL_CloseHaptic(m_resource); }
889
892 {
893 std::swap(m_resource, other.m_resource);
894 return *this;
895 }
896
898 constexpr HapticRaw get() const { return m_resource; }
899
901 constexpr HapticRaw release()
902 {
903 auto r = m_resource;
904 m_resource = nullptr;
905 return r;
906 }
907
909 constexpr auto operator<=>(const Haptic& other) const = default;
910
912 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
913
915 constexpr explicit operator bool() const { return !!m_resource; }
916
918 constexpr operator HapticParam() const { return {m_resource}; }
919
928 void Close();
929
938 HapticID GetID();
939
951 const char* GetName();
952
968 int GetMaxEffects();
969
984
997
1009 int GetNumAxes();
1010
1022 bool EffectSupported(const HapticEffect& effect);
1023
1038 int CreateEffect(const HapticEffect& effect);
1039
1058 void UpdateEffect(int effect, const HapticEffect& data);
1059
1080 void RunEffect(int effect, Uint32 iterations);
1081
1093 void StopEffect(int effect);
1094
1107 void DestroyEffect(int effect);
1108
1122 bool GetEffectStatus(int effect);
1123
1142 void SetGain(int gain);
1143
1159 void SetAutocenter(int autocenter);
1160
1176 void Pause();
1177
1189 void Resume();
1190
1201 void StopEffects();
1202
1212 bool RumbleSupported();
1213
1225 void InitRumble();
1226
1239 void PlayRumble(float strength, Uint32 length);
1240
1250 void StopRumble();
1251};
1252
1255{
1264 : Haptic(resource.value)
1265 {
1266 }
1267
1269 HapticRef(const HapticRef& other)
1270 : Haptic(other.get())
1271 {
1272 }
1273
1276};
1277
1289{
1290 int count;
1291 auto data = SDL_GetHaptics(&count);
1292 return OwnArray<HapticID>{data};
1293}
1294
1310inline const char* GetHapticNameForID(HapticID instance_id)
1311{
1312 return SDL_GetHapticNameForID(instance_id);
1313}
1314
1338inline Haptic OpenHaptic(HapticID instance_id) { return Haptic(instance_id); }
1339
1350{
1351 return {CheckError(SDL_GetHapticFromID(instance_id))};
1352}
1353
1364{
1365 return CheckError(SDL_GetHapticID(haptic));
1366}
1367
1368inline HapticID Haptic::GetID() { return SDL::GetHapticID(m_resource); }
1369
1382inline const char* GetHapticName(HapticParam haptic)
1383{
1384 return SDL_GetHapticName(haptic);
1385}
1386
1387inline const char* Haptic::GetName() { return SDL::GetHapticName(m_resource); }
1388
1398inline bool IsMouseHaptic() { return SDL_IsMouseHaptic(); }
1399
1412{
1413 return Haptic(SDL_OpenHapticFromMouse());
1414}
1415
1417
1428inline bool IsJoystickHaptic(JoystickParam joystick)
1429{
1430 return SDL_IsJoystickHaptic(joystick);
1431}
1432
1454{
1455 return Haptic(joystick);
1456}
1457
1467inline void CloseHaptic(HapticRaw haptic) { SDL_CloseHaptic(haptic); }
1468
1469inline void Haptic::Close() { CloseHaptic(release()); }
1470
1488{
1489 return SDL_GetMaxHapticEffects(haptic);
1490}
1491
1493{
1494 return SDL::GetMaxHapticEffects(m_resource);
1495}
1496
1512{
1513 return SDL_GetMaxHapticEffectsPlaying(haptic);
1514}
1515
1517{
1518 return SDL::GetMaxHapticEffectsPlaying(m_resource);
1519}
1520
1534{
1535 return SDL_GetHapticFeatures(haptic);
1536}
1537
1539{
1540 return SDL::GetHapticFeatures(m_resource);
1541}
1542
1556{
1557 return CheckError(SDL_GetNumHapticAxes(haptic));
1558}
1559
1560inline int Haptic::GetNumAxes() { return SDL::GetNumHapticAxes(m_resource); }
1561
1575 const HapticEffect& effect)
1576{
1577 return SDL_HapticEffectSupported(haptic, &effect);
1578}
1579
1580inline bool Haptic::EffectSupported(const HapticEffect& effect)
1581{
1582 return SDL::HapticEffectSupported(m_resource, effect);
1583}
1584
1600inline int CreateHapticEffect(HapticParam haptic, const HapticEffect& effect)
1601{
1602 return CheckError(SDL_CreateHapticEffect(haptic, &effect));
1603}
1604
1605inline int Haptic::CreateEffect(const HapticEffect& effect)
1606{
1607 return SDL::CreateHapticEffect(m_resource, effect);
1608}
1609
1630 int effect,
1631 const HapticEffect& data)
1632{
1633 CheckError(SDL_UpdateHapticEffect(haptic, effect, &data));
1634}
1635
1636inline void Haptic::UpdateEffect(int effect, const HapticEffect& data)
1637{
1638 SDL::UpdateHapticEffect(m_resource, effect, data);
1639}
1640
1662inline void RunHapticEffect(HapticParam haptic, int effect, Uint32 iterations)
1663{
1664 CheckError(SDL_RunHapticEffect(haptic, effect, iterations));
1665}
1666
1667inline void Haptic::RunEffect(int effect, Uint32 iterations)
1668{
1669 SDL::RunHapticEffect(m_resource, effect, iterations);
1670}
1671
1684inline void StopHapticEffect(HapticParam haptic, int effect)
1685{
1686 CheckError(SDL_StopHapticEffect(haptic, effect));
1687}
1688
1689inline void Haptic::StopEffect(int effect)
1690{
1691 SDL::StopHapticEffect(m_resource, effect);
1692}
1693
1707inline void DestroyHapticEffect(HapticParam haptic, int effect)
1708{
1709 SDL_DestroyHapticEffect(haptic, effect);
1710}
1711
1712inline void Haptic::DestroyEffect(int effect)
1713{
1714 SDL::DestroyHapticEffect(m_resource, effect);
1715}
1716
1731inline bool GetHapticEffectStatus(HapticParam haptic, int effect)
1732{
1733 return SDL_GetHapticEffectStatus(haptic, effect);
1734}
1735
1736inline bool Haptic::GetEffectStatus(int effect)
1737{
1738 return SDL::GetHapticEffectStatus(m_resource, effect);
1739}
1740
1760inline void SetHapticGain(HapticParam haptic, int gain)
1761{
1762 CheckError(SDL_SetHapticGain(haptic, gain));
1763}
1764
1765inline void Haptic::SetGain(int gain) { SDL::SetHapticGain(m_resource, gain); }
1766
1783inline void SetHapticAutocenter(HapticParam haptic, int autocenter)
1784{
1785 CheckError(SDL_SetHapticAutocenter(haptic, autocenter));
1786}
1787
1788inline void Haptic::SetAutocenter(int autocenter)
1789{
1790 SDL::SetHapticAutocenter(m_resource, autocenter);
1791}
1792
1809inline void PauseHaptic(HapticParam haptic)
1810{
1811 CheckError(SDL_PauseHaptic(haptic));
1812}
1813
1814inline void Haptic::Pause() { SDL::PauseHaptic(m_resource); }
1815
1828inline void ResumeHaptic(HapticParam haptic)
1829{
1830 CheckError(SDL_ResumeHaptic(haptic));
1831}
1832
1833inline void Haptic::Resume() { SDL::ResumeHaptic(m_resource); }
1834
1847{
1848 CheckError(SDL_StopHapticEffects(haptic));
1849}
1850
1851inline void Haptic::StopEffects() { SDL::StopHapticEffects(m_resource); }
1852
1864{
1865 return SDL_HapticRumbleSupported(haptic);
1866}
1867
1869{
1870 return SDL::HapticRumbleSupported(m_resource);
1871}
1872
1886{
1887 CheckError(SDL_InitHapticRumble(haptic));
1888}
1889
1890inline void Haptic::InitRumble() { SDL::InitHapticRumble(m_resource); }
1891
1905inline void PlayHapticRumble(HapticParam haptic, float strength, Uint32 length)
1906{
1907 CheckError(SDL_PlayHapticRumble(haptic, strength, length));
1908}
1909
1910inline void Haptic::PlayRumble(float strength, Uint32 length)
1911{
1912 SDL::PlayHapticRumble(m_resource, strength, length);
1913}
1914
1926{
1927 CheckError(SDL_StopHapticRumble(haptic));
1928}
1929
1930inline void Haptic::StopRumble() { SDL::StopHapticRumble(m_resource); }
1931
1933
1934} // namespace SDL
1935
1936#endif /* SDL3PP_HAPTIC_H_ */
The haptic structure used to identify an SDL haptic.
Definition: SDL3pp_haptic.h:789
constexpr Haptic(Haptic &&other)
Move constructor.
Definition: SDL3pp_haptic.h:812
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_haptic.h:912
Haptic & operator=(Haptic other)
Assignment operator.
Definition: SDL3pp_haptic.h:891
constexpr HapticRaw release()
Retrieves underlying HapticRaw and clear this.
Definition: SDL3pp_haptic.h:901
constexpr HapticRaw get() const
Retrieves underlying HapticRaw.
Definition: SDL3pp_haptic.h:898
Haptic(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:869
constexpr Haptic(const Haptic &other)=delete
Copy constructor.
constexpr Haptic()=default
Default ctor.
~Haptic()
Destructor.
Definition: SDL3pp_haptic.h:888
Haptic(HapticID instance_id)
Open a haptic device for use.
Definition: SDL3pp_haptic.h:844
constexpr Haptic(const HapticRaw resource)
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:803
constexpr auto operator<=>(const Haptic &other) const =default
Comparison.
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:198
void RunHapticEffect(HapticParam haptic, int effect, Uint32 iterations)
Run the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1662
void StopHapticEffects(HapticParam haptic)
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1846
constexpr HapticEffectType HAPTIC_FRICTION
Friction effect supported - uses axes movement.
Definition: SDL3pp_haptic.h:277
Haptic OpenHaptic(HapticID instance_id)
Open a haptic device for use.
Definition: SDL3pp_haptic.h:1338
void StopHapticRumble(HapticParam haptic)
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1925
int GetMaxHapticEffectsPlaying(HapticParam haptic)
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1511
void Pause()
Pause a haptic device.
Definition: SDL3pp_haptic.h:1814
void SetHapticAutocenter(HapticParam haptic, int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1783
constexpr HapticEffectType HAPTIC_GAIN
Device can set global gain.
Definition: SDL3pp_haptic.h:329
bool IsJoystickHaptic(JoystickParam joystick)
Query if a joystick has haptic features.
Definition: SDL3pp_haptic.h:1428
void SetGain(int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1765
SDL_HapticDirection HapticDirection
Structure that represents a haptic direction.
Definition: SDL3pp_haptic.h:529
void StopHapticEffect(HapticParam haptic, int effect)
Stop the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1684
int GetMaxEffectsPlaying()
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1516
HapticID GetHapticID(HapticParam haptic)
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1363
constexpr HapticEffectType HAPTIC_SINE
Sine wave effect supported.
Definition: SDL3pp_haptic.h:174
void StopEffect(int effect)
Stop the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1689
Haptic OpenHapticFromJoystick(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:1453
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
void SetHapticGain(HapticParam haptic, int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1760
constexpr Uint32 HAPTIC_INFINITY
Used to play a device an infinite number of times.
Definition: SDL3pp_haptic.h:423
constexpr HapticEffectType HAPTIC_DAMPER
Damper effect supported - uses axes velocity.
Definition: SDL3pp_haptic.h:253
void UpdateEffect(int effect, const HapticEffect &data)
Update the properties of an effect.
Definition: SDL3pp_haptic.h:1636
bool HapticEffectSupported(HapticParam haptic, const HapticEffect &effect)
Check to see if an effect is supported by a haptic device.
Definition: SDL3pp_haptic.h:1574
Uint8 HapticDirectionType
Direction encoding.
Definition: SDL3pp_haptic.h:373
void PlayHapticRumble(HapticParam haptic, float strength, Uint32 length)
Run a simple rumble effect on a haptic device.
Definition: SDL3pp_haptic.h:1905
int GetNumHapticAxes(HapticParam haptic)
Get the number of haptic axes the device has.
Definition: SDL3pp_haptic.h:1555
void InitHapticRumble(HapticParam haptic)
Initialize a haptic device for simple rumble playback.
Definition: SDL3pp_haptic.h:1885
void Resume()
Resume a haptic device.
Definition: SDL3pp_haptic.h:1833
constexpr HapticEffectType HAPTIC_RESERVED3
Reserved for future use.
Definition: SDL3pp_haptic.h:309
const char * GetHapticName(HapticParam haptic)
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1382
constexpr HapticEffectType HAPTIC_INERTIA
Inertia effect supported - uses axes acceleration.
Definition: SDL3pp_haptic.h:265
constexpr HapticEffectType HAPTIC_SPRING
Spring effect supported - uses axes position.
Definition: SDL3pp_haptic.h:241
constexpr HapticEffectType HAPTIC_LEFTRIGHT
Left/Right effect supported.
Definition: SDL3pp_haptic.h:288
SDL_HapticCondition HapticCondition
A structure containing a template for a Condition effect.
Definition: SDL3pp_haptic.h:637
int CreateEffect(const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1605
const char * GetHapticNameForID(HapticID instance_id)
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1310
constexpr HapticEffectType HAPTIC_CUSTOM
Custom effect is supported.
Definition: SDL3pp_haptic.h:318
void InitRumble()
Initialize a haptic device for simple rumble playback.
Definition: SDL3pp_haptic.h:1890
bool GetHapticEffectStatus(HapticParam haptic, int effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1731
void StopRumble()
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1930
void SetAutocenter(int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1788
Haptic OpenHapticFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1411
constexpr HapticDirectionType HAPTIC_STEERING_AXIS
Use this value to play an effect on the steering wheel axis.
Definition: SDL3pp_haptic.h:412
bool IsMouseHaptic()
Query whether or not the current mouse has haptic capabilities.
Definition: SDL3pp_haptic.h:1398
SDL_HapticConstant HapticConstant
A structure containing a template for a Constant effect.
Definition: SDL3pp_haptic.h:544
int GetNumAxes()
Get the number of haptic axes the device has.
Definition: SDL3pp_haptic.h:1560
SDL_HapticRamp HapticRamp
A structure containing a template for a Ramp effect.
Definition: SDL3pp_haptic.h:654
void PlayRumble(float strength, Uint32 length)
Run a simple rumble effect on a haptic device.
Definition: SDL3pp_haptic.h:1910
bool RumbleSupported()
Check whether rumble is supported on a haptic device.
Definition: SDL3pp_haptic.h:1868
constexpr HapticEffectType HAPTIC_PAUSE
Device can be paused.
Definition: SDL3pp_haptic.h:363
constexpr HapticEffectType HAPTIC_SQUARE
Square wave effect supported.
Definition: SDL3pp_haptic.h:185
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:196
bool EffectSupported(const HapticEffect &effect)
Check to see if an effect is supported by a haptic device.
Definition: SDL3pp_haptic.h:1580
SDL_HapticPeriodic HapticPeriodic
A structure containing a template for a Periodic effect.
Definition: SDL3pp_haptic.h:608
void DestroyEffect(int effect)
Destroy a haptic effect on the device.
Definition: SDL3pp_haptic.h:1712
bool GetEffectStatus(int effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1736
void DestroyHapticEffect(HapticParam haptic, int effect)
Destroy a haptic effect on the device.
Definition: SDL3pp_haptic.h:1707
Uint32 GetHapticFeatures(HapticParam haptic)
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1533
constexpr HapticEffectType HAPTIC_RESERVED1
Reserved for future use.
Definition: SDL3pp_haptic.h:295
void RunEffect(int effect, Uint32 iterations)
Run the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1667
void CloseHaptic(HapticRaw haptic)
Close a haptic device previously opened with Haptic.Haptic().
Definition: SDL3pp_haptic.h:1467
constexpr HapticDirectionType HAPTIC_SPHERICAL
Uses spherical coordinates for the direction.
Definition: SDL3pp_haptic.h:400
constexpr HapticEffectType HAPTIC_AUTOCENTER
Device can set autocenter.
Definition: SDL3pp_haptic.h:340
void ResumeHaptic(HapticParam haptic)
Resume a haptic device.
Definition: SDL3pp_haptic.h:1828
static Haptic OpenFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1416
HapticID GetID()
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1368
constexpr HapticEffectType HAPTIC_SAWTOOTHDOWN
Sawtoothdown wave effect supported.
Definition: SDL3pp_haptic.h:218
constexpr HapticDirectionType HAPTIC_CARTESIAN
Uses cartesian coordinates for the direction.
Definition: SDL3pp_haptic.h:391
bool HapticRumbleSupported(HapticParam haptic)
Check whether rumble is supported on a haptic device.
Definition: SDL3pp_haptic.h:1863
int GetMaxEffects()
Get the number of effects a haptic device can store.
Definition: SDL3pp_haptic.h:1492
constexpr HapticDirectionType HAPTIC_POLAR
Uses polar coordinates for the direction.
Definition: SDL3pp_haptic.h:382
constexpr HapticEffectType HAPTIC_CONSTANT
Constant effect supported.
Definition: SDL3pp_haptic.h:163
int GetMaxHapticEffects(HapticParam haptic)
Get the number of effects a haptic device can store.
Definition: SDL3pp_haptic.h:1487
Uint32 HapticEffectType
Haptic effects flag constants.
Definition: SDL3pp_haptic.h:152
constexpr HapticEffectType HAPTIC_RESERVED2
Reserved for future use.
Definition: SDL3pp_haptic.h:302
HapticRef GetHapticFromID(HapticID instance_id)
Get the Haptic associated with an instance ID, if it has been opened.
Definition: SDL3pp_haptic.h:1349
const char * GetName()
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1387
constexpr HapticEffectType HAPTIC_STATUS
Device can be queried for effect status.
Definition: SDL3pp_haptic.h:351
SDL_HapticCustom HapticCustom
A structure containing a template for the HAPTIC_CUSTOM effect.
Definition: SDL3pp_haptic.h:689
OwnArray< HapticID > GetHaptics()
Get a list of currently connected haptic devices.
Definition: SDL3pp_haptic.h:1288
int CreateHapticEffect(HapticParam haptic, const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1600
Uint32 GetFeatures()
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1538
void PauseHaptic(HapticParam haptic)
Pause a haptic device.
Definition: SDL3pp_haptic.h:1809
constexpr HapticEffectType HAPTIC_SAWTOOTHUP
Sawtoothup wave effect supported.
Definition: SDL3pp_haptic.h:207
SDL_HapticEffect HapticEffect
The generic template for any haptic effect.
Definition: SDL3pp_haptic.h:763
void StopEffects()
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1851
SDL_HapticLeftRight HapticLeftRight
A structure containing a template for a Left/Right effect.
Definition: SDL3pp_haptic.h:670
void UpdateHapticEffect(HapticParam haptic, int effect, const HapticEffect &data)
Update the properties of an effect.
Definition: SDL3pp_haptic.h:1629
constexpr HapticEffectType HAPTIC_RAMP
Ramp effect supported.
Definition: SDL3pp_haptic.h:229
void Close()
Close a haptic device previously opened with Haptic.Haptic().
Definition: SDL3pp_haptic.h:1469
Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:325
Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:257
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:1255
~HapticRef()
Destructor.
Definition: SDL3pp_haptic.h:1275
HapticRef(HapticParam resource)
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:1263
HapticRef(const HapticRef &other)
Copy constructor.
Definition: SDL3pp_haptic.h:1269
Safely wrap Joystick for non owning parameters.
Definition: SDL3pp_joystick.h:60