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
636using HapticCondition = SDL_HapticCondition;
637
653using HapticRamp = SDL_HapticRamp;
654
669using HapticLeftRight = SDL_HapticLeftRight;
670
688using HapticCustom = SDL_HapticCustom;
689
762using HapticEffect = SDL_HapticEffect;
763
774using HapticID = SDL_HapticID;
775
788{
789 HapticRaw m_resource = nullptr;
790
791public:
793 constexpr Haptic() = default;
794
802 constexpr explicit Haptic(const HapticRaw resource)
803 : m_resource(resource)
804 {
805 }
806
808 constexpr Haptic(const Haptic& other) = delete;
809
811 constexpr Haptic(Haptic&& other)
812 : Haptic(other.release())
813 {
814 }
815
816 constexpr Haptic(const HapticRef& other) = delete;
817
818 constexpr Haptic(HapticRef&& other) = delete;
819
843 Haptic(HapticID instance_id)
844 : m_resource(SDL_OpenHaptic(instance_id))
845 {
846 }
847
869 : m_resource(CheckError(SDL_OpenHapticFromJoystick(joystick)))
870 {
871 }
872
884 static Haptic OpenFromMouse();
885
887 ~Haptic() { SDL_CloseHaptic(m_resource); }
888
891 {
892 std::swap(m_resource, other.m_resource);
893 return *this;
894 }
895
897 constexpr HapticRaw get() const { return m_resource; }
898
900 constexpr HapticRaw release()
901 {
902 auto r = m_resource;
903 m_resource = nullptr;
904 return r;
905 }
906
908 constexpr auto operator<=>(const Haptic& other) const = default;
909
911 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
912
914 constexpr explicit operator bool() const { return !!m_resource; }
915
917 constexpr operator HapticParam() const { return {m_resource}; }
918
926 void Close();
927
936 HapticID GetID();
937
949 const char* GetName();
950
966 int GetMaxEffects();
967
982
995
1007 int GetNumAxes();
1008
1020 bool EffectSupported(const HapticEffect& effect);
1021
1036 int CreateEffect(const HapticEffect& effect);
1037
1056 void UpdateEffect(int effect, const HapticEffect& data);
1057
1077 void RunEffect(int effect, Uint32 iterations);
1078
1090 void StopEffect(int effect);
1091
1104 void DestroyEffect(int effect);
1105
1119 bool GetEffectStatus(int effect);
1120
1139 void SetGain(int gain);
1140
1156 void SetAutocenter(int autocenter);
1157
1173 void Pause();
1174
1186 void Resume();
1187
1198 void StopEffects();
1199
1209 bool RumbleSupported();
1210
1222 void InitRumble();
1223
1236 void PlayRumble(float strength, Uint32 length);
1237
1247 void StopRumble();
1248};
1249
1252{
1261 : Haptic(resource.value)
1262 {
1263 }
1264
1266 HapticRef(const HapticRef& other)
1267 : Haptic(other.get())
1268 {
1269 }
1270
1273};
1274
1286{
1287 int count;
1288 auto data = SDL_GetHaptics(&count);
1289 return OwnArray<HapticID>{data};
1290}
1291
1306inline const char* GetHapticNameForID(HapticID instance_id)
1307{
1308 return SDL_GetHapticNameForID(instance_id);
1309}
1310
1334inline Haptic OpenHaptic(HapticID instance_id) { return Haptic(instance_id); }
1335
1346{
1347 return {CheckError(SDL_GetHapticFromID(instance_id))};
1348}
1349
1360{
1361 return CheckError(SDL_GetHapticID(haptic));
1362}
1363
1364inline HapticID Haptic::GetID() { return SDL::GetHapticID(m_resource); }
1365
1377inline const char* GetHapticName(HapticParam haptic)
1378{
1379 return SDL_GetHapticName(haptic);
1380}
1381
1382inline const char* Haptic::GetName() { return SDL::GetHapticName(m_resource); }
1383
1393inline bool IsMouseHaptic() { return SDL_IsMouseHaptic(); }
1394
1407{
1408 return Haptic(SDL_OpenHapticFromMouse());
1409}
1410
1412
1423inline bool IsJoystickHaptic(JoystickParam joystick)
1424{
1425 return SDL_IsJoystickHaptic(joystick);
1426}
1427
1449{
1450 return Haptic(joystick);
1451}
1452
1462inline void CloseHaptic(HapticRaw haptic) { SDL_CloseHaptic(haptic); }
1463
1464inline void Haptic::Close() { CloseHaptic(release()); }
1465
1483{
1484 return SDL_GetMaxHapticEffects(haptic);
1485}
1486
1488{
1489 return SDL::GetMaxHapticEffects(m_resource);
1490}
1491
1507{
1508 return SDL_GetMaxHapticEffectsPlaying(haptic);
1509}
1510
1512{
1513 return SDL::GetMaxHapticEffectsPlaying(m_resource);
1514}
1515
1529{
1530 return SDL_GetHapticFeatures(haptic);
1531}
1532
1534{
1535 return SDL::GetHapticFeatures(m_resource);
1536}
1537
1551{
1552 return CheckError(SDL_GetNumHapticAxes(haptic));
1553}
1554
1555inline int Haptic::GetNumAxes() { return SDL::GetNumHapticAxes(m_resource); }
1556
1570 const HapticEffect& effect)
1571{
1572 return SDL_HapticEffectSupported(haptic, &effect);
1573}
1574
1575inline bool Haptic::EffectSupported(const HapticEffect& effect)
1576{
1577 return SDL::HapticEffectSupported(m_resource, effect);
1578}
1579
1595inline int CreateHapticEffect(HapticParam haptic, const HapticEffect& effect)
1596{
1597 return CheckError(SDL_CreateHapticEffect(haptic, &effect));
1598}
1599
1600inline int Haptic::CreateEffect(const HapticEffect& effect)
1601{
1602 return SDL::CreateHapticEffect(m_resource, effect);
1603}
1604
1625 int effect,
1626 const HapticEffect& data)
1627{
1628 CheckError(SDL_UpdateHapticEffect(haptic, effect, &data));
1629}
1630
1631inline void Haptic::UpdateEffect(int effect, const HapticEffect& data)
1632{
1633 SDL::UpdateHapticEffect(m_resource, effect, data);
1634}
1635
1656inline void RunHapticEffect(HapticParam haptic, int effect, Uint32 iterations)
1657{
1658 CheckError(SDL_RunHapticEffect(haptic, effect, iterations));
1659}
1660
1661inline void Haptic::RunEffect(int effect, Uint32 iterations)
1662{
1663 SDL::RunHapticEffect(m_resource, effect, iterations);
1664}
1665
1678inline void StopHapticEffect(HapticParam haptic, int effect)
1679{
1680 CheckError(SDL_StopHapticEffect(haptic, effect));
1681}
1682
1683inline void Haptic::StopEffect(int effect)
1684{
1685 SDL::StopHapticEffect(m_resource, effect);
1686}
1687
1701inline void DestroyHapticEffect(HapticParam haptic, int effect)
1702{
1703 SDL_DestroyHapticEffect(haptic, effect);
1704}
1705
1706inline void Haptic::DestroyEffect(int effect)
1707{
1708 SDL::DestroyHapticEffect(m_resource, effect);
1709}
1710
1725inline bool GetHapticEffectStatus(HapticParam haptic, int effect)
1726{
1727 return SDL_GetHapticEffectStatus(haptic, effect);
1728}
1729
1730inline bool Haptic::GetEffectStatus(int effect)
1731{
1732 return SDL::GetHapticEffectStatus(m_resource, effect);
1733}
1734
1753inline void SetHapticGain(HapticParam haptic, int gain)
1754{
1755 CheckError(SDL_SetHapticGain(haptic, gain));
1756}
1757
1758inline void Haptic::SetGain(int gain) { SDL::SetHapticGain(m_resource, gain); }
1759
1776inline void SetHapticAutocenter(HapticParam haptic, int autocenter)
1777{
1778 CheckError(SDL_SetHapticAutocenter(haptic, autocenter));
1779}
1780
1781inline void Haptic::SetAutocenter(int autocenter)
1782{
1783 SDL::SetHapticAutocenter(m_resource, autocenter);
1784}
1785
1802inline void PauseHaptic(HapticParam haptic)
1803{
1804 CheckError(SDL_PauseHaptic(haptic));
1805}
1806
1807inline void Haptic::Pause() { SDL::PauseHaptic(m_resource); }
1808
1821inline void ResumeHaptic(HapticParam haptic)
1822{
1823 CheckError(SDL_ResumeHaptic(haptic));
1824}
1825
1826inline void Haptic::Resume() { SDL::ResumeHaptic(m_resource); }
1827
1840{
1841 CheckError(SDL_StopHapticEffects(haptic));
1842}
1843
1844inline void Haptic::StopEffects() { SDL::StopHapticEffects(m_resource); }
1845
1857{
1858 return SDL_HapticRumbleSupported(haptic);
1859}
1860
1862{
1863 return SDL::HapticRumbleSupported(m_resource);
1864}
1865
1879{
1880 CheckError(SDL_InitHapticRumble(haptic));
1881}
1882
1883inline void Haptic::InitRumble() { SDL::InitHapticRumble(m_resource); }
1884
1898inline void PlayHapticRumble(HapticParam haptic, float strength, Uint32 length)
1899{
1900 CheckError(SDL_PlayHapticRumble(haptic, strength, length));
1901}
1902
1903inline void Haptic::PlayRumble(float strength, Uint32 length)
1904{
1905 SDL::PlayHapticRumble(m_resource, strength, length);
1906}
1907
1919{
1920 CheckError(SDL_StopHapticRumble(haptic));
1921}
1922
1923inline void Haptic::StopRumble() { SDL::StopHapticRumble(m_resource); }
1924
1926
1927} // namespace SDL
1928
1929#endif /* SDL3PP_HAPTIC_H_ */
The haptic structure used to identify an SDL haptic.
Definition: SDL3pp_haptic.h:788
constexpr Haptic(Haptic &&other)
Move constructor.
Definition: SDL3pp_haptic.h:811
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_haptic.h:911
Haptic & operator=(Haptic other)
Assignment operator.
Definition: SDL3pp_haptic.h:890
constexpr HapticRaw release()
Retrieves underlying HapticRaw and clear this.
Definition: SDL3pp_haptic.h:900
constexpr HapticRaw get() const
Retrieves underlying HapticRaw.
Definition: SDL3pp_haptic.h:897
Haptic(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:868
constexpr Haptic(const Haptic &other)=delete
Copy constructor.
constexpr Haptic()=default
Default ctor.
~Haptic()
Destructor.
Definition: SDL3pp_haptic.h:887
Haptic(HapticID instance_id)
Open a haptic device for use.
Definition: SDL3pp_haptic.h:843
constexpr Haptic(const HapticRaw resource)
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:802
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:197
void RunHapticEffect(HapticParam haptic, int effect, Uint32 iterations)
Run the haptic effect on its associated haptic device.
Definition: SDL3pp_haptic.h:1656
void StopHapticEffects(HapticParam haptic)
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1839
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:1334
void StopHapticRumble(HapticParam haptic)
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1918
int GetMaxHapticEffectsPlaying(HapticParam haptic)
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1506
void Pause()
Pause a haptic device.
Definition: SDL3pp_haptic.h:1807
void SetHapticAutocenter(HapticParam haptic, int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1776
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:1423
void SetGain(int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1758
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:1678
int GetMaxEffectsPlaying()
Get the number of effects a haptic device can play at the same time.
Definition: SDL3pp_haptic.h:1511
HapticID GetHapticID(HapticParam haptic)
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1359
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:1683
Haptic OpenHapticFromJoystick(JoystickParam joystick)
Open a haptic device for use from a joystick device.
Definition: SDL3pp_haptic.h:1448
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:774
void SetHapticGain(HapticParam haptic, int gain)
Set the global gain of the specified haptic device.
Definition: SDL3pp_haptic.h:1753
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:1631
bool HapticEffectSupported(HapticParam haptic, const HapticEffect &effect)
Check to see if an effect is supported by a haptic device.
Definition: SDL3pp_haptic.h:1569
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:1898
int GetNumHapticAxes(HapticParam haptic)
Get the number of haptic axes the device has.
Definition: SDL3pp_haptic.h:1550
void InitHapticRumble(HapticParam haptic)
Initialize a haptic device for simple rumble playback.
Definition: SDL3pp_haptic.h:1878
void Resume()
Resume a haptic device.
Definition: SDL3pp_haptic.h:1826
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:1377
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:636
int CreateEffect(const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1600
const char * GetHapticNameForID(HapticID instance_id)
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1306
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:1883
bool GetHapticEffectStatus(HapticParam haptic, int effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1725
void StopRumble()
Stop the simple rumble on a haptic device.
Definition: SDL3pp_haptic.h:1923
void SetAutocenter(int autocenter)
Set the global autocenter of the device.
Definition: SDL3pp_haptic.h:1781
Haptic OpenHapticFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1406
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:1393
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:1555
SDL_HapticRamp HapticRamp
A structure containing a template for a Ramp effect.
Definition: SDL3pp_haptic.h:653
void PlayRumble(float strength, Uint32 length)
Run a simple rumble effect on a haptic device.
Definition: SDL3pp_haptic.h:1903
bool RumbleSupported()
Check whether rumble is supported on a haptic device.
Definition: SDL3pp_haptic.h:1861
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:1575
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:1706
bool GetEffectStatus(int effect)
Get the status of the current effect on the specified haptic device.
Definition: SDL3pp_haptic.h:1730
void DestroyHapticEffect(HapticParam haptic, int effect)
Destroy a haptic effect on the device.
Definition: SDL3pp_haptic.h:1701
Uint32 GetHapticFeatures(HapticParam haptic)
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1528
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:1661
void CloseHaptic(HapticRaw haptic)
Close a haptic device previously opened with Haptic.Haptic().
Definition: SDL3pp_haptic.h:1462
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:1821
static Haptic OpenFromMouse()
Try to open a haptic device from the current mouse.
Definition: SDL3pp_haptic.h:1411
HapticID GetID()
Get the instance ID of an opened haptic device.
Definition: SDL3pp_haptic.h:1364
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:1856
int GetMaxEffects()
Get the number of effects a haptic device can store.
Definition: SDL3pp_haptic.h:1487
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:1482
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:1345
const char * GetName()
Get the implementation dependent name of a haptic device.
Definition: SDL3pp_haptic.h:1382
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:688
OwnArray< HapticID > GetHaptics()
Get a list of currently connected haptic devices.
Definition: SDL3pp_haptic.h:1285
int CreateHapticEffect(HapticParam haptic, const HapticEffect &effect)
Create a new haptic effect on a specified device.
Definition: SDL3pp_haptic.h:1595
Uint32 GetFeatures()
Get the haptic device's supported features in bitwise manner.
Definition: SDL3pp_haptic.h:1533
void PauseHaptic(HapticParam haptic)
Pause a haptic device.
Definition: SDL3pp_haptic.h:1802
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:762
void StopEffects()
Stop all the currently playing effects on a haptic device.
Definition: SDL3pp_haptic.h:1844
SDL_HapticLeftRight HapticLeftRight
A structure containing a template for a Left/Right effect.
Definition: SDL3pp_haptic.h:669
void UpdateHapticEffect(HapticParam haptic, int effect, const HapticEffect &data)
Update the properties of an effect.
Definition: SDL3pp_haptic.h:1624
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:1464
::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:1252
~HapticRef()
Destructor.
Definition: SDL3pp_haptic.h:1272
HapticRef(HapticParam resource)
Constructs from HapticParam.
Definition: SDL3pp_haptic.h:1260
HapticRef(const HapticRef &other)
Copy constructor.
Definition: SDL3pp_haptic.h:1266
Safely wrap Joystick for non owning parameters.
Definition: SDL3pp_joystick.h:60