SDL3pp
A slim C++ wrapper for SDL3
|
The haptic structure used to identify an SDL haptic. More...
Public Member Functions | |
constexpr | Haptic ()=default |
Default ctor. | |
constexpr | Haptic (const HapticRaw resource) |
Constructs from HapticParam. More... | |
constexpr | Haptic (const Haptic &other)=delete |
Copy constructor. | |
constexpr | Haptic (Haptic &&other) |
Move constructor. | |
constexpr | Haptic (const HapticRef &other)=delete |
constexpr | Haptic (HapticRef &&other)=delete |
Haptic (HapticID instance_id) | |
Open a haptic device for use. More... | |
Haptic (JoystickParam joystick) | |
Open a haptic device for use from a joystick device. More... | |
~Haptic () | |
Destructor. | |
Haptic & | operator= (Haptic other) |
Assignment operator. | |
constexpr HapticRaw | get () const |
Retrieves underlying HapticRaw. | |
constexpr HapticRaw | release () |
Retrieves underlying HapticRaw and clear this. | |
constexpr auto | operator<=> (const Haptic &other) const =default |
Comparison. | |
constexpr bool | operator== (std::nullptr_t _) const |
Comparison. | |
constexpr | operator bool () const |
Converts to bool. | |
constexpr | operator HapticParam () const |
Converts to HapticParam. | |
void | Close () |
Close a haptic device previously opened with Haptic.Haptic(). More... | |
HapticID | GetID () |
Get the instance ID of an opened haptic device. More... | |
const char * | GetName () |
Get the implementation dependent name of a haptic device. More... | |
int | GetMaxEffects () |
Get the number of effects a haptic device can store. More... | |
int | GetMaxEffectsPlaying () |
Get the number of effects a haptic device can play at the same time. More... | |
Uint32 | GetFeatures () |
Get the haptic device's supported features in bitwise manner. More... | |
int | GetNumAxes () |
Get the number of haptic axes the device has. More... | |
bool | EffectSupported (const HapticEffect &effect) |
Check to see if an effect is supported by a haptic device. More... | |
int | CreateEffect (const HapticEffect &effect) |
Create a new haptic effect on a specified device. More... | |
void | UpdateEffect (int effect, const HapticEffect &data) |
Update the properties of an effect. More... | |
void | RunEffect (int effect, Uint32 iterations) |
Run the haptic effect on its associated haptic device. More... | |
void | StopEffect (int effect) |
Stop the haptic effect on its associated haptic device. More... | |
void | DestroyEffect (int effect) |
Destroy a haptic effect on the device. More... | |
bool | GetEffectStatus (int effect) |
Get the status of the current effect on the specified haptic device. More... | |
void | SetGain (int gain) |
Set the global gain of the specified haptic device. More... | |
void | SetAutocenter (int autocenter) |
Set the global autocenter of the device. More... | |
void | Pause () |
Pause a haptic device. More... | |
void | Resume () |
Resume a haptic device. More... | |
void | StopEffects () |
Stop all the currently playing effects on a haptic device. More... | |
bool | RumbleSupported () |
Check whether rumble is supported on a haptic device. More... | |
void | InitRumble () |
Initialize a haptic device for simple rumble playback. More... | |
void | PlayRumble (float strength, Uint32 length) |
Run a simple rumble effect on a haptic device. More... | |
void | StopRumble () |
Stop the simple rumble on a haptic device. More... | |
Static Public Member Functions | |
static Haptic | OpenFromMouse () |
Try to open a haptic device from the current mouse. More... | |
|
inlineexplicitconstexpr |
resource | a HapticRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.
|
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().
instance_id | the haptic device instance ID. |
|
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.
joystick | the Joystick to create a haptic device from. |
Error | on failure. |