sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.Haptic.FunPtr

Synopsis

Documentation

sDL_GetHaptics :: FunPtr (Ptr CInt -> IO (Ptr SDL_HapticID)) Source #

Get a list of currently connected haptic devices.

count
a pointer filled in with the number of haptic devices returned, may be NULL.
Returns
a 0 terminated array of haptic device instance IDs or NULL on failure; call SDL_GetError() for more information. This should be freed with SDL_free() when it is no longer needed.
See also
sDL_OpenHaptic
C declaration
SDL_GetHaptics, defined at SDL3/SDL_haptic.h 975:44

Since: 3.2.0

sDL_GetHapticNameForID :: FunPtr (SDL_HapticID -> IO (PtrConst CChar)) Source #

Get the implementation dependent name of a haptic device.

This can be called before any haptic devices are opened.

instance_id
the haptic device instance ID.
Returns
the name of the selected haptic device. If no name can be found, this function returns NULL; call SDL_GetError() for more information.
See also
sDL_GetHapticName, sDL_OpenHaptic
C declaration
SDL_GetHapticNameForID, defined at SDL3/SDL_haptic.h 992:42

Since: 3.2.0

sDL_OpenHaptic :: FunPtr (SDL_HapticID -> IO (Ptr SDL_Haptic)) Source #

Open a haptic device for use.

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 SDL_SetHapticGain() and SDL_SetHapticAutocenter().

instance_id
the haptic device instance ID.
Returns
the device identifier or NULL on failure; call SDL_GetError() for more information.
See also
sDL_CloseHaptic, sDL_GetHaptics, sDL_OpenHapticFromJoystick, sDL_OpenHapticFromMouse, sDL_SetHapticAutocenter, sDL_SetHapticGain
C declaration
SDL_OpenHaptic, defined at SDL3/SDL_haptic.h 1017:42

Since: 3.2.0

sDL_GetHapticFromID :: FunPtr (SDL_HapticID -> IO (Ptr SDL_Haptic)) Source #

Get the SDL_Haptic associated with an instance ID, if it has been opened.

instance_id
the instance ID to get the SDL_Haptic for.
Returns
an SDL_Haptic on success or NULL on failure or if it hasn't been opened yet; call SDL_GetError() for more information.
C declaration
SDL_GetHapticFromID, defined at SDL3/SDL_haptic.h 1029:42

Since: 3.2.0

sDL_GetHapticID :: FunPtr (Ptr SDL_Haptic -> IO SDL_HapticID) Source #

Get the instance ID of an opened haptic device.

haptic
the SDL_Haptic device to query.
Returns
the instance ID of the specified haptic device on success or 0 on failure; call SDL_GetError() for more information.
C declaration
SDL_GetHapticID, defined at SDL3/SDL_haptic.h 1040:42

Since: 3.2.0

sDL_GetHapticName :: FunPtr (Ptr SDL_Haptic -> IO (PtrConst CChar)) Source #

Get the implementation dependent name of a haptic device.

haptic
the SDL_Haptic obtained from SDL_OpenJoystick().
Returns
the name of the selected haptic device. If no name can be found, this function returns NULL; call SDL_GetError() for more information.
See also
sDL_GetHapticNameForID
C declaration
SDL_GetHapticName, defined at SDL3/SDL_haptic.h 1054:42

Since: 3.2.0

sDL_IsMouseHaptic :: FunPtr (IO CBool) Source #

Query whether or not the current mouse has haptic capabilities.

Returns
true if the mouse is haptic or false if it isn't.
See also
sDL_OpenHapticFromMouse
C declaration
SDL_IsMouseHaptic, defined at SDL3/SDL_haptic.h 1065:34

Since: 3.2.0

sDL_OpenHapticFromMouse :: FunPtr (IO (Ptr SDL_Haptic)) Source #

Try to open a haptic device from the current mouse.

Returns
the haptic device identifier or NULL on failure; call SDL_GetError() for more information.
See also
sDL_CloseHaptic, sDL_IsMouseHaptic
C declaration
SDL_OpenHapticFromMouse, defined at SDL3/SDL_haptic.h 1078:42

Since: 3.2.0

sDL_IsJoystickHaptic :: FunPtr (Ptr SDL_Joystick -> IO CBool) Source #

Query if a joystick has haptic features.

joystick
the SDL_Joystick to test for haptic capabilities.
Returns
true if the joystick is haptic or false if it isn't.
See also
sDL_OpenHapticFromJoystick
C declaration
SDL_IsJoystickHaptic, defined at SDL3/SDL_haptic.h 1090:34

Since: 3.2.0

sDL_OpenHapticFromJoystick :: FunPtr (Ptr SDL_Joystick -> IO (Ptr SDL_Haptic)) Source #

Open a haptic device for use from a joystick device.

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 SDL_Joystick to create a haptic device from.
Returns
a valid haptic device identifier on success or NULL on failure; call SDL_GetError() for more information.
See also
sDL_CloseHaptic, sDL_IsJoystickHaptic
C declaration
SDL_OpenHapticFromJoystick, defined at SDL3/SDL_haptic.h 1112:42

Since: 3.2.0

sDL_CloseHaptic :: FunPtr (Ptr SDL_Haptic -> IO ()) Source #

Close a haptic device previously opened with SDL_OpenHaptic().

haptic
the SDL_Haptic device to close.
See also
sDL_OpenHaptic
C declaration
SDL_CloseHaptic, defined at SDL3/SDL_haptic.h 1123:34

Since: 3.2.0

sDL_GetMaxHapticEffects :: FunPtr (Ptr SDL_Haptic -> IO CInt) Source #

Get the number of effects a haptic device can store.

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

haptic
the SDL_Haptic device to query.
Returns
the number of effects the haptic device can store or a negative error code on failure; call SDL_GetError() for more information.
See also
sDL_GetMaxHapticEffectsPlaying, sDL_GetHapticFeatures
C declaration
SDL_GetMaxHapticEffects, defined at SDL3/SDL_haptic.h 1141:33

Since: 3.2.0

sDL_GetMaxHapticEffectsPlaying :: FunPtr (Ptr SDL_Haptic -> IO CInt) Source #

Get the number of effects a haptic device can play at the same time.

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

haptic
the SDL_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 SDL_GetError() for more information.
See also
sDL_GetMaxHapticEffects, sDL_GetHapticFeatures
C declaration
SDL_GetMaxHapticEffectsPlaying, defined at SDL3/SDL_haptic.h 1157:33

Since: 3.2.0

sDL_GetHapticFeatures :: FunPtr (Ptr SDL_Haptic -> IO Uint32) Source #

Get the haptic device's supported features in bitwise manner.

haptic
the SDL_Haptic device to query.
Returns
a list of supported haptic features in bitwise manner (OR'd), or 0 on failure; call SDL_GetError() for more information.
See also
sDL_HapticEffectSupported, sDL_GetMaxHapticEffects
C declaration
SDL_GetHapticFeatures, defined at SDL3/SDL_haptic.h 1171:36

Since: 3.2.0

sDL_GetNumHapticAxes :: FunPtr (Ptr SDL_Haptic -> IO CInt) Source #

Get the number of haptic axes the device has.

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

haptic
the SDL_Haptic device to query.
Returns
the number of axes on success or -1 on failure; call SDL_GetError() for more information.
C declaration
SDL_GetNumHapticAxes, defined at SDL3/SDL_haptic.h 1185:33

Since: 3.2.0

sDL_HapticEffectSupported :: FunPtr (Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO CBool) Source #

Check to see if an effect is supported by a haptic device.

haptic
the SDL_Haptic device to query.
effect
the desired effect to query.
Returns
true if the effect is supported or false if it isn't.
See also
sDL_CreateHapticEffect, sDL_GetHapticFeatures
C declaration
SDL_HapticEffectSupported, defined at SDL3/SDL_haptic.h 1199:34

Since: 3.2.0

sDL_CreateHapticEffect :: FunPtr (Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO SDL_HapticEffectID) Source #

Create a new haptic effect on a specified device.

haptic
an SDL_Haptic device to create the effect on.
effect
an SDL_HapticEffect structure containing the properties of the effect to create.
Returns
the ID of the effect on success or -1 on failure; call SDL_GetError() for more information.
See also
sDL_DestroyHapticEffect, sDL_RunHapticEffect, sDL_UpdateHapticEffect
C declaration
SDL_CreateHapticEffect, defined at SDL3/SDL_haptic.h 1216:48

Since: 3.2.0

sDL_UpdateHapticEffect :: FunPtr (Ptr SDL_Haptic -> SDL_HapticEffectID -> PtrConst SDL_HapticEffect -> IO CBool) Source #

Update the properties of an effect.

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

haptic
the SDL_Haptic device that has the effect.
effect
the identifier of the effect to update.
data
an SDL_HapticEffect structure containing the new effect properties to use.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_CreateHapticEffect, sDL_RunHapticEffect
C declaration
SDL_UpdateHapticEffect, defined at SDL3/SDL_haptic.h 1238:34

Since: 3.2.0

sDL_RunHapticEffect :: FunPtr (Ptr SDL_Haptic -> SDL_HapticEffectID -> Uint32 -> IO CBool) Source #

Run the haptic effect on its associated haptic device.

To repeat the effect over and over indefinitely, set iterations to sDL_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 sDL_HAPTIC_INFINITY instead.

haptic
the SDL_Haptic device to run the effect on.
effect
the ID of the haptic effect to run.
iterations
the number of iterations to run the effect; use sDL_HAPTIC_INFINITY to repeat forever.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_GetHapticEffectStatus, sDL_StopHapticEffect, sDL_StopHapticEffects
C declaration
SDL_RunHapticEffect, defined at SDL3/SDL_haptic.h 1262:34

Since: 3.2.0

sDL_StopHapticEffect :: FunPtr (Ptr SDL_Haptic -> SDL_HapticEffectID -> IO CBool) Source #

Stop the haptic effect on its associated haptic device.

haptic
the SDL_Haptic device to stop the effect on.
effect
the ID of the haptic effect to stop.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_RunHapticEffect, sDL_StopHapticEffects
C declaration
SDL_StopHapticEffect, defined at SDL3/SDL_haptic.h 1277:34

Since: 3.2.0

sDL_DestroyHapticEffect :: FunPtr (Ptr SDL_Haptic -> SDL_HapticEffectID -> IO ()) Source #

Destroy a haptic effect on the device.

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

haptic
the SDL_Haptic device to destroy the effect on.
effect
the ID of the haptic effect to destroy.
See also
sDL_CreateHapticEffect
C declaration
SDL_DestroyHapticEffect, defined at SDL3/SDL_haptic.h 1292:34

Since: 3.2.0

sDL_GetHapticEffectStatus :: FunPtr (Ptr SDL_Haptic -> SDL_HapticEffectID -> IO CBool) Source #

Get the status of the current effect on the specified haptic device.

Device must support the SDL_HAPTIC_STATUS feature.

haptic
the SDL_Haptic device to query for the effect status on.
effect
the 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.
See also
sDL_GetHapticFeatures
C declaration
SDL_GetHapticEffectStatus, defined at SDL3/SDL_haptic.h 1308:34

Since: 3.2.0

sDL_SetHapticGain :: FunPtr (Ptr SDL_Haptic -> CInt -> IO CBool) Source #

Set the global gain of the specified haptic device.

Device must support the SDL_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 SDL_SetHapticGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.

haptic
the SDL_Haptic device to set the gain on.
gain
value to set the gain to, should be between 0 and 100 (0 - 100).
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_GetHapticFeatures
C declaration
SDL_SetHapticGain, defined at SDL3/SDL_haptic.h 1330:34

Since: 3.2.0

sDL_SetHapticAutocenter :: FunPtr (Ptr SDL_Haptic -> CInt -> IO CBool) Source #

Set the global autocenter of the device.

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

Device must support the SDL_HAPTIC_AUTOCENTER feature.

haptic
the SDL_Haptic device to set autocentering on.
autocenter
value to set autocenter to (0-100).
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_GetHapticFeatures
C declaration
SDL_SetHapticAutocenter, defined at SDL3/SDL_haptic.h 1349:34

Since: 3.2.0

sDL_PauseHaptic :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Pause a haptic device.

Device must support the sDL_HAPTIC_PAUSE feature. Call SDL_ResumeHaptic() 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.

haptic
the SDL_Haptic device to pause.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_ResumeHaptic
C declaration
SDL_PauseHaptic, defined at SDL3/SDL_haptic.h 1368:34

Since: 3.2.0

sDL_ResumeHaptic :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Resume a haptic device.

Call to unpause after SDL_PauseHaptic().

haptic
the SDL_Haptic device to unpause.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_PauseHaptic
C declaration
SDL_ResumeHaptic, defined at SDL3/SDL_haptic.h 1383:34

Since: 3.2.0

sDL_StopHapticEffects :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Stop all the currently playing effects on a haptic device.

haptic
the SDL_Haptic device to stop.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_RunHapticEffect, sDL_StopHapticEffect
C declaration
SDL_StopHapticEffects, defined at SDL3/SDL_haptic.h 1397:34

Since: 3.2.0

sDL_HapticRumbleSupported :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Check whether rumble is supported on a haptic device.

haptic
haptic device to check for rumble support.
Returns
true if the effect is supported or false if it isn't.
See also
sDL_InitHapticRumble
C declaration
SDL_HapticRumbleSupported, defined at SDL3/SDL_haptic.h 1409:34

Since: 3.2.0

sDL_InitHapticRumble :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Initialize a haptic device for simple rumble playback.

haptic
the haptic device to initialize for simple rumble playback.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_PlayHapticRumble, sDL_StopHapticRumble, sDL_HapticRumbleSupported
C declaration
SDL_InitHapticRumble, defined at SDL3/SDL_haptic.h 1424:34

Since: 3.2.0

sDL_PlayHapticRumble :: FunPtr (Ptr SDL_Haptic -> CFloat -> Uint32 -> IO CBool) Source #

Run a simple rumble effect on a haptic device.

haptic
the haptic device to play the rumble effect on.
strength
strength of the rumble to play as a 0-1 float value.
length
length of the rumble to play in milliseconds.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_InitHapticRumble, sDL_StopHapticRumble
C declaration
SDL_PlayHapticRumble, defined at SDL3/SDL_haptic.h 1440:34

Since: 3.2.0

sDL_StopHapticRumble :: FunPtr (Ptr SDL_Haptic -> IO CBool) Source #

Stop the simple rumble on a haptic device.

haptic
the haptic device to stop the rumble effect on.
Returns
true on success or false on failure; call SDL_GetError() for more information.
See also
sDL_PlayHapticRumble
C declaration
SDL_StopHapticRumble, defined at SDL3/SDL_haptic.h 1453:34

Since: 3.2.0