sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.Haptic.Unsafe

Synopsis

Documentation

sDL_GetHaptics Source #

Arguments

:: Ptr CInt
count
a pointer filled in with the number of haptic devices returned, may be NULL.
-> IO (Ptr SDL_HapticID) 

Get a list of currently connected haptic devices.

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 Source #

Arguments

:: SDL_HapticID
instance_id
the haptic device instance ID.
-> IO (PtrConst CChar) 

Get the implementation dependent name of a haptic device.

This can be called before any haptic devices are opened.

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 Source #

Arguments

:: SDL_HapticID
instance_id
the haptic device instance ID.
-> IO (Ptr SDL_Haptic) 

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

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 Source #

Arguments

:: SDL_HapticID
instance_id
the instance ID to get the SDL_Haptic for.
-> IO (Ptr SDL_Haptic) 

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query.
-> IO SDL_HapticID 

Get the instance ID of an opened haptic device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic obtained from SDL_OpenJoystick().
-> IO (PtrConst CChar) 

Get the implementation dependent name of a haptic device.

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 :: 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 :: 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 Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick to test for haptic capabilities.
-> IO CBool 

Query if a joystick has haptic features.

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 Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick to create a haptic device from.
-> IO (Ptr SDL_Haptic) 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to close.
-> IO () 

Close a haptic device previously opened with SDL_OpenHaptic().

See also
sDL_OpenHaptic
C declaration
SDL_CloseHaptic, defined at SDL3/SDL_haptic.h 1123:34

Since: 3.2.0

sDL_GetMaxHapticEffects Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query.
-> IO CInt 

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query maximum playing effects.
-> IO CInt 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query.
-> IO Uint32 

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query.
-> IO CInt 

Get the number of haptic axes the device has.

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query.
-> PtrConst SDL_HapticEffect
effect
the desired effect to query.
-> IO CBool 

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
an SDL_Haptic device to create the effect on.
-> PtrConst SDL_HapticEffect
effect
an SDL_HapticEffect structure containing the properties of the effect to create.
-> IO SDL_HapticEffectID 

Create a new haptic effect on a specified device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device that has the effect.
-> SDL_HapticEffectID
effect
the identifier of the effect to update.
-> PtrConst SDL_HapticEffect
data
an SDL_HapticEffect structure containing the new effect properties to use.
-> IO CBool 

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

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to run the effect on.
-> SDL_HapticEffectID
effect
the ID of the haptic effect to run.
-> Uint32
iterations
the number of iterations to run the effect; use sDL_HAPTIC_INFINITY to repeat forever.
-> IO CBool 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to stop the effect on.
-> SDL_HapticEffectID
effect
the ID of the haptic effect to stop.
-> IO CBool 

Stop the haptic effect on its associated haptic device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to destroy the effect on.
-> SDL_HapticEffectID
effect
the ID of the haptic effect to destroy.
-> IO () 

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.

See also
sDL_CreateHapticEffect
C declaration
SDL_DestroyHapticEffect, defined at SDL3/SDL_haptic.h 1292:34

Since: 3.2.0

sDL_GetHapticEffectStatus Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to query for the effect status on.
-> SDL_HapticEffectID
effect
the ID of the haptic effect to query its status.
-> IO CBool 

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

Device must support the SDL_HAPTIC_STATUS feature.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to set the gain on.
-> CInt
gain
value to set the gain to, should be between 0 and 100 (0 - 100).
-> IO CBool 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to set autocentering on.
-> CInt
autocenter
value to set autocenter to (0-100).
-> IO CBool 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to pause.
-> IO CBool 

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.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to unpause.
-> IO CBool 

Resume a haptic device.

Call to unpause after SDL_PauseHaptic().

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic device to stop.
-> IO CBool 

Stop all the currently playing effects on a haptic device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
haptic device to check for rumble support.
-> IO CBool 

Check whether rumble is supported on a haptic device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the haptic device to initialize for simple rumble playback.
-> IO CBool 

Initialize a haptic device 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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the haptic device to play the rumble effect on.
-> CFloat
strength
strength of the rumble to play as a 0-1 float value.
-> Uint32
length
length of the rumble to play in milliseconds.
-> IO CBool 

Run a simple rumble effect on a haptic device.

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 Source #

Arguments

:: Ptr SDL_Haptic
haptic
the haptic device to stop the rumble effect on.
-> IO CBool 

Stop the simple rumble on a haptic device.

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