sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Haptic

Description

The SDL haptic subsystem manages haptic (force feedback) devices.

The basic usage is as follows:

Simple rumble example:

    SDL_Haptic *haptic = NULL;

    // Open the device
    SDL_HapticID *haptics = SDL_GetHaptics(NULL);
    if (haptics) {
        haptic = SDL_OpenHaptic(haptics[0]);
        SDL_free(haptics);
    }
    if (haptic == NULL)
       return;

    // Initialize simple rumble
    if (!SDL_InitHapticRumble(haptic))
       return;

    // Play effect at 50% strength for 2 seconds
    if (!SDL_PlayHapticRumble(haptic, 0.5, 2000))
       return;
    SDL_Delay(2000);

    // Clean up
    SDL_CloseHaptic(haptic);
    

Complete example:

    bool test_haptic(SDL_Joystick *joystick)
    {
       SDL_Haptic *haptic;
       SDL_HapticEffect effect;
       SDL_HapticEffectID effect_id;

       // Open the device
       haptic = SDL_OpenHapticFromJoystick(joystick);
       if (haptic == NULL) return false; // Most likely joystick isn't haptic

       // See if it can do sine waves
       if ((SDL_GetHapticFeatures(haptic) & SDL_HAPTIC_SINE)==0) {
          SDL_CloseHaptic(haptic); // No sine effect
          return false;
       }

       // Create the effect
       SDL_memset(&effect, 0, sizeof(SDL_HapticEffect)); // 0 is safe default
       effect.type = SDL_HAPTIC_SINE;
       effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
       effect.periodic.direction.dir[0] = 18000; // Force comes from south
       effect.periodic.period = 1000; // 1000 ms
       effect.periodic.magnitude = 20000; // 20000/32767 strength
       effect.periodic.length = 5000; // 5 seconds long
       effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
       effect.periodic.fade_length = 1000; // Takes 1 second to fade away

       // Upload the effect
       effect_id = SDL_CreateHapticEffect(haptic, &effect);

       // Test the effect
       SDL_RunHapticEffect(haptic, effect_id, 1);
       SDL_Delay(5000); // Wait for the effect to finish

       // We destroy the effect, although closing the device also does this
       SDL_DestroyHapticEffect(haptic, effect_id);

       // Close the device
       SDL_CloseHaptic(haptic);

       return true; // Success
    }
    

Note that the SDL haptic subsystem is not thread-safe. The haptic structure used to identify an SDL haptic.

See also
openHaptic, openHapticFromJoystick, closeHaptic

FFI conventions

Unsuffixed aliases are unsafe foreign imports; aliases suffixed Safe are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under SDL3.Sys.Bindgen.Haptic.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.

Full conventions: SDL3.Sys.

Since: 3.2.0

Synopsis

Documentation

Typed constants

pattern SDL_HAPTIC_POLAR :: SDL_HapticDirectionType Source #

Typed constant for macro SDL_HAPTIC_POLAR.

pattern SDL_HAPTIC_CARTESIAN :: SDL_HapticDirectionType Source #

Typed constant for macro SDL_HAPTIC_CARTESIAN.

pattern SDL_HAPTIC_SPHERICAL :: SDL_HapticDirectionType Source #

Typed constant for macro SDL_HAPTIC_SPHERICAL.

pattern SDL_HAPTIC_STEERING_AXIS :: SDL_HapticDirectionType Source #

Typed constant for macro SDL_HAPTIC_STEERING_AXIS.

pattern SDL_HAPTIC_CONSTANT :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_CONSTANT. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_SINE :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_SINE. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_SQUARE :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_SQUARE. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_TRIANGLE :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_TRIANGLE. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_SAWTOOTHUP :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_SAWTOOTHUP. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_SAWTOOTHDOWN :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_SAWTOOTHDOWN. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_RAMP :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_RAMP. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_SPRING :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_SPRING. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_DAMPER :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_DAMPER. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_INERTIA :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_INERTIA. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_FRICTION :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_FRICTION. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_LEFTRIGHT :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_LEFTRIGHT. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_RESERVED1 :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_RESERVED1. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_RESERVED2 :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_RESERVED2. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_RESERVED3 :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_RESERVED3. Combine with .|. from Data.Bits.

pattern SDL_HAPTIC_CUSTOM :: SDL_HapticEffectType Source #

Typed constant for macro SDL_HAPTIC_CUSTOM. Combine with .|. from Data.Bits.

Function aliases

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 getError for more information. This should be freed with free when it is no longer needed.
See also
openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHaptics. The safe flavor is getHapticsSafe .
C declaration
SDL_GetHaptics, defined at SDL3/SDL_haptic.h 975:44

Since: 3.2.0

getHapticsSafe 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 getError for more information. This should be freed with free when it is no longer needed.
See also
openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHaptics. The unsafe flavor is getHaptics .
C declaration
SDL_GetHaptics, defined at SDL3/SDL_haptic.h 975:44

Since: 3.2.0

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 getError for more information.
See also
getHapticName, openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticNameForID. The safe flavor is getHapticNameForIDSafe .
C declaration
SDL_GetHapticNameForID, defined at SDL3/SDL_haptic.h 992:42

Since: 3.2.0

getHapticNameForIDSafe 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 getError for more information.
See also
getHapticName, openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticNameForID. The unsafe flavor is getHapticNameForID .
C declaration
SDL_GetHapticNameForID, defined at SDL3/SDL_haptic.h 992:42

Since: 3.2.0

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 setHapticGain and setHapticAutocenter.

Returns
the device identifier or NULL on failure; call getError for more information.
See also
closeHaptic, getHaptics, openHapticFromJoystick, openHapticFromMouse, setHapticAutocenter, setHapticGain

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_OpenHaptic. The safe flavor is openHapticSafe .
C declaration
SDL_OpenHaptic, defined at SDL3/SDL_haptic.h 1017:42

Since: 3.2.0

openHapticSafe 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 setHapticGain and setHapticAutocenter.

Returns
the device identifier or NULL on failure; call getError for more information.
See also
closeHaptic, getHaptics, openHapticFromJoystick, openHapticFromMouse, setHapticAutocenter, setHapticGain

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_OpenHaptic. The unsafe flavor is openHaptic .
C declaration
SDL_OpenHaptic, defined at SDL3/SDL_haptic.h 1017:42

Since: 3.2.0

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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticFromID. The safe flavor is getHapticFromIDSafe .
C declaration
SDL_GetHapticFromID, defined at SDL3/SDL_haptic.h 1029:42

Since: 3.2.0

getHapticFromIDSafe 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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticFromID. The unsafe flavor is getHapticFromID .
C declaration
SDL_GetHapticFromID, defined at SDL3/SDL_haptic.h 1029:42

Since: 3.2.0

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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticID. The safe flavor is getHapticIDSafe .
C declaration
SDL_GetHapticID, defined at SDL3/SDL_haptic.h 1040:42

Since: 3.2.0

getHapticIDSafe 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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticID. The unsafe flavor is getHapticID .
C declaration
SDL_GetHapticID, defined at SDL3/SDL_haptic.h 1040:42

Since: 3.2.0

getHapticName Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic obtained from 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 getError for more information.
See also
getHapticNameForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticName. The safe flavor is getHapticNameSafe .
C declaration
SDL_GetHapticName, defined at SDL3/SDL_haptic.h 1054:42

Since: 3.2.0

getHapticNameSafe Source #

Arguments

:: Ptr SDL_Haptic
haptic
the SDL_Haptic obtained from 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 getError for more information.
See also
getHapticNameForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticName. The unsafe flavor is getHapticName .
C declaration
SDL_GetHapticName, defined at SDL3/SDL_haptic.h 1054:42

Since: 3.2.0

isMouseHaptic :: IO Bool 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
openHapticFromMouse

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_IsMouseHaptic. The safe flavor is isMouseHapticSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_IsMouseHaptic, defined at SDL3/SDL_haptic.h 1065:34

Since: 3.2.0

isMouseHapticSafe :: IO Bool 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
openHapticFromMouse

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_IsMouseHaptic. The unsafe flavor is isMouseHaptic .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_IsMouseHaptic, defined at SDL3/SDL_haptic.h 1065:34

Since: 3.2.0

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 getError for more information.
See also
closeHaptic, isMouseHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_OpenHapticFromMouse. The safe flavor is openHapticFromMouseSafe .
C declaration
SDL_OpenHapticFromMouse, defined at SDL3/SDL_haptic.h 1078:42

Since: 3.2.0

openHapticFromMouseSafe :: 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 getError for more information.
See also
closeHaptic, isMouseHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_OpenHapticFromMouse. The unsafe flavor is openHapticFromMouse .
C declaration
SDL_OpenHapticFromMouse, defined at SDL3/SDL_haptic.h 1078:42

Since: 3.2.0

isJoystickHaptic Source #

Arguments

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

Query if a joystick has haptic features.

Returns
true if the joystick is haptic or false if it isn't.
See also
openHapticFromJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_IsJoystickHaptic. The safe flavor is isJoystickHapticSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_IsJoystickHaptic, defined at SDL3/SDL_haptic.h 1090:34

Since: 3.2.0

isJoystickHapticSafe Source #

Arguments

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

Query if a joystick has haptic features.

Returns
true if the joystick is haptic or false if it isn't.
See also
openHapticFromJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_IsJoystickHaptic. The unsafe flavor is isJoystickHaptic .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_IsJoystickHaptic, defined at SDL3/SDL_haptic.h 1090:34

Since: 3.2.0

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 getError for more information.
See also
closeHaptic, isJoystickHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_OpenHapticFromJoystick. The safe flavor is openHapticFromJoystickSafe .
C declaration
SDL_OpenHapticFromJoystick, defined at SDL3/SDL_haptic.h 1112:42

Since: 3.2.0

openHapticFromJoystickSafe 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 getError for more information.
See also
closeHaptic, isJoystickHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_OpenHapticFromJoystick. The unsafe flavor is openHapticFromJoystick .
C declaration
SDL_OpenHapticFromJoystick, defined at SDL3/SDL_haptic.h 1112:42

Since: 3.2.0

closeHaptic Source #

Arguments

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

Close a haptic device previously opened with openHaptic.

See also
openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_CloseHaptic. The safe flavor is closeHapticSafe .
C declaration
SDL_CloseHaptic, defined at SDL3/SDL_haptic.h 1123:34

Since: 3.2.0

closeHapticSafe Source #

Arguments

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

Close a haptic device previously opened with openHaptic.

See also
openHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_CloseHaptic. The unsafe flavor is closeHaptic .
C declaration
SDL_CloseHaptic, defined at SDL3/SDL_haptic.h 1123:34

Since: 3.2.0

getMaxHapticEffects Source #

Arguments

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

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 getMaxHapticEffects.

Returns
the number of effects the haptic device can store or a negative error code on failure; call getError for more information.
See also
getMaxHapticEffectsPlaying, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetMaxHapticEffects. The safe flavor is getMaxHapticEffectsSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetMaxHapticEffects, defined at SDL3/SDL_haptic.h 1141:33

Since: 3.2.0

getMaxHapticEffectsSafe Source #

Arguments

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

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 getMaxHapticEffects.

Returns
the number of effects the haptic device can store or a negative error code on failure; call getError for more information.
See also
getMaxHapticEffectsPlaying, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetMaxHapticEffects. The unsafe flavor is getMaxHapticEffects .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetMaxHapticEffects, defined at SDL3/SDL_haptic.h 1141:33

Since: 3.2.0

getMaxHapticEffectsPlaying Source #

Arguments

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

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 getError for more information.
See also
getMaxHapticEffects, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetMaxHapticEffectsPlaying. The safe flavor is getMaxHapticEffectsPlayingSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetMaxHapticEffectsPlaying, defined at SDL3/SDL_haptic.h 1157:33

Since: 3.2.0

getMaxHapticEffectsPlayingSafe Source #

Arguments

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

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 getError for more information.
See also
getMaxHapticEffects, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetMaxHapticEffectsPlaying. The unsafe flavor is getMaxHapticEffectsPlaying .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetMaxHapticEffectsPlaying, defined at SDL3/SDL_haptic.h 1157:33

Since: 3.2.0

getHapticFeatures Source #

Arguments

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

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 getError for more information.
See also
hapticEffectSupported, getMaxHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticFeatures. The safe flavor is getHapticFeaturesSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetHapticFeatures, defined at SDL3/SDL_haptic.h 1171:36

Since: 3.2.0

getHapticFeaturesSafe Source #

Arguments

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

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 getError for more information.
See also
hapticEffectSupported, getMaxHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticFeatures. The unsafe flavor is getHapticFeatures .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetHapticFeatures, defined at SDL3/SDL_haptic.h 1171:36

Since: 3.2.0

getNumHapticAxes Source #

Arguments

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

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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetNumHapticAxes. The safe flavor is getNumHapticAxesSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetNumHapticAxes, defined at SDL3/SDL_haptic.h 1185:33

Since: 3.2.0

getNumHapticAxesSafe Source #

Arguments

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

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 getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetNumHapticAxes. The unsafe flavor is getNumHapticAxes .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetNumHapticAxes, defined at SDL3/SDL_haptic.h 1185:33

Since: 3.2.0

hapticEffectSupported Source #

Arguments

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

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
createHapticEffect, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_HapticEffectSupported. The safe flavor is hapticEffectSupportedSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_HapticEffectSupported, defined at SDL3/SDL_haptic.h 1199:34

Since: 3.2.0

hapticEffectSupportedSafe Source #

Arguments

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

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
createHapticEffect, getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_HapticEffectSupported. The unsafe flavor is hapticEffectSupported .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_HapticEffectSupported, defined at SDL3/SDL_haptic.h 1199:34

Since: 3.2.0

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 getError for more information.
See also
destroyHapticEffect, runHapticEffect, updateHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_CreateHapticEffect. The safe flavor is createHapticEffectSafe .
C declaration
SDL_CreateHapticEffect, defined at SDL3/SDL_haptic.h 1216:48

Since: 3.2.0

createHapticEffectSafe 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 getError for more information.
See also
destroyHapticEffect, runHapticEffect, updateHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_CreateHapticEffect. The unsafe flavor is createHapticEffect .
C declaration
SDL_CreateHapticEffect, defined at SDL3/SDL_haptic.h 1216:48

Since: 3.2.0

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 Bool 

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 updateHapticEffect.

Returns
true on success or false on failure; call getError for more information.
See also
createHapticEffect, runHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_UpdateHapticEffect. The safe flavor is updateHapticEffectSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_UpdateHapticEffect, defined at SDL3/SDL_haptic.h 1238:34

Since: 3.2.0

updateHapticEffectSafe 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 Bool 

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 updateHapticEffect.

Returns
true on success or false on failure; call getError for more information.
See also
createHapticEffect, runHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_UpdateHapticEffect. The unsafe flavor is updateHapticEffect .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_UpdateHapticEffect, defined at SDL3/SDL_haptic.h 1238:34

Since: 3.2.0

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.
-> Word32
iterations
the number of iterations to run the effect; use sDL_HAPTIC_INFINITY to repeat forever.
-> IO Bool 

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 getError for more information.
See also
getHapticEffectStatus, stopHapticEffect, stopHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_RunHapticEffect. The safe flavor is runHapticEffectSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_RunHapticEffect, defined at SDL3/SDL_haptic.h 1262:34

Since: 3.2.0

runHapticEffectSafe 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.
-> Word32
iterations
the number of iterations to run the effect; use sDL_HAPTIC_INFINITY to repeat forever.
-> IO Bool 

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 getError for more information.
See also
getHapticEffectStatus, stopHapticEffect, stopHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_RunHapticEffect. The unsafe flavor is runHapticEffect .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_RunHapticEffect, defined at SDL3/SDL_haptic.h 1262:34

Since: 3.2.0

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 Bool 

Stop the haptic effect on its associated haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
runHapticEffect, stopHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_StopHapticEffect. The safe flavor is stopHapticEffectSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticEffect, defined at SDL3/SDL_haptic.h 1277:34

Since: 3.2.0

stopHapticEffectSafe 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 Bool 

Stop the haptic effect on its associated haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
runHapticEffect, stopHapticEffects

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_StopHapticEffect. The unsafe flavor is stopHapticEffect .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticEffect, defined at SDL3/SDL_haptic.h 1277:34

Since: 3.2.0

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
createHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_DestroyHapticEffect. The safe flavor is destroyHapticEffectSafe .
C declaration
SDL_DestroyHapticEffect, defined at SDL3/SDL_haptic.h 1292:34

Since: 3.2.0

destroyHapticEffectSafe 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
createHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_DestroyHapticEffect. The unsafe flavor is destroyHapticEffect .
C declaration
SDL_DestroyHapticEffect, defined at SDL3/SDL_haptic.h 1292:34

Since: 3.2.0

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 Bool 

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
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetHapticEffectStatus. The safe flavor is getHapticEffectStatusSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetHapticEffectStatus, defined at SDL3/SDL_haptic.h 1308:34

Since: 3.2.0

getHapticEffectStatusSafe 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 Bool 

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
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetHapticEffectStatus. The unsafe flavor is getHapticEffectStatus .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_GetHapticEffectStatus, defined at SDL3/SDL_haptic.h 1308:34

Since: 3.2.0

setHapticGain Source #

Arguments

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

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 setHapticGain will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.

Returns
true on success or false on failure; call getError for more information.
See also
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetHapticGain. The safe flavor is setHapticGainSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_SetHapticGain, defined at SDL3/SDL_haptic.h 1330:34

Since: 3.2.0

setHapticGainSafe Source #

Arguments

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

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 setHapticGain will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.

Returns
true on success or false on failure; call getError for more information.
See also
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetHapticGain. The unsafe flavor is setHapticGain .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_SetHapticGain, defined at SDL3/SDL_haptic.h 1330:34

Since: 3.2.0

setHapticAutocenter Source #

Arguments

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

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 getError for more information.
See also
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetHapticAutocenter. The safe flavor is setHapticAutocenterSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_SetHapticAutocenter, defined at SDL3/SDL_haptic.h 1349:34

Since: 3.2.0

setHapticAutocenterSafe Source #

Arguments

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

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 getError for more information.
See also
getHapticFeatures

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetHapticAutocenter. The unsafe flavor is setHapticAutocenter .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_SetHapticAutocenter, defined at SDL3/SDL_haptic.h 1349:34

Since: 3.2.0

pauseHaptic Source #

Arguments

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

Pause a haptic device.

Device must support the sDL_HAPTIC_PAUSE feature. Call 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 getError for more information.
See also
resumeHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_PauseHaptic. The safe flavor is pauseHapticSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_PauseHaptic, defined at SDL3/SDL_haptic.h 1368:34

Since: 3.2.0

pauseHapticSafe Source #

Arguments

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

Pause a haptic device.

Device must support the sDL_HAPTIC_PAUSE feature. Call 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 getError for more information.
See also
resumeHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_PauseHaptic. The unsafe flavor is pauseHaptic .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_PauseHaptic, defined at SDL3/SDL_haptic.h 1368:34

Since: 3.2.0

resumeHaptic Source #

Arguments

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

Resume a haptic device.

Call to unpause after pauseHaptic.

Returns
true on success or false on failure; call getError for more information.
See also
pauseHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_ResumeHaptic. The safe flavor is resumeHapticSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_ResumeHaptic, defined at SDL3/SDL_haptic.h 1383:34

Since: 3.2.0

resumeHapticSafe Source #

Arguments

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

Resume a haptic device.

Call to unpause after pauseHaptic.

Returns
true on success or false on failure; call getError for more information.
See also
pauseHaptic

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_ResumeHaptic. The unsafe flavor is resumeHaptic .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_ResumeHaptic, defined at SDL3/SDL_haptic.h 1383:34

Since: 3.2.0

stopHapticEffects Source #

Arguments

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

Stop all the currently playing effects on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
runHapticEffect, stopHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_StopHapticEffects. The safe flavor is stopHapticEffectsSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticEffects, defined at SDL3/SDL_haptic.h 1397:34

Since: 3.2.0

stopHapticEffectsSafe Source #

Arguments

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

Stop all the currently playing effects on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
runHapticEffect, stopHapticEffect

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_StopHapticEffects. The unsafe flavor is stopHapticEffects .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticEffects, defined at SDL3/SDL_haptic.h 1397:34

Since: 3.2.0

hapticRumbleSupported Source #

Arguments

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

Check whether rumble is supported on a haptic device.

Returns
true if the effect is supported or false if it isn't.
See also
initHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_HapticRumbleSupported. The safe flavor is hapticRumbleSupportedSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_HapticRumbleSupported, defined at SDL3/SDL_haptic.h 1409:34

Since: 3.2.0

hapticRumbleSupportedSafe Source #

Arguments

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

Check whether rumble is supported on a haptic device.

Returns
true if the effect is supported or false if it isn't.
See also
initHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_HapticRumbleSupported. The unsafe flavor is hapticRumbleSupported .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_HapticRumbleSupported, defined at SDL3/SDL_haptic.h 1409:34

Since: 3.2.0

initHapticRumble Source #

Arguments

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

Initialize a haptic device for simple rumble playback.

Returns
true on success or false on failure; call getError for more information.
See also
playHapticRumble, stopHapticRumble, hapticRumbleSupported

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_InitHapticRumble. The safe flavor is initHapticRumbleSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_InitHapticRumble, defined at SDL3/SDL_haptic.h 1424:34

Since: 3.2.0

initHapticRumbleSafe Source #

Arguments

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

Initialize a haptic device for simple rumble playback.

Returns
true on success or false on failure; call getError for more information.
See also
playHapticRumble, stopHapticRumble, hapticRumbleSupported

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_InitHapticRumble. The unsafe flavor is initHapticRumble .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_InitHapticRumble, defined at SDL3/SDL_haptic.h 1424:34

Since: 3.2.0

playHapticRumble Source #

Arguments

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

Run a simple rumble effect on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
initHapticRumble, stopHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_PlayHapticRumble. The safe flavor is playHapticRumbleSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_PlayHapticRumble, defined at SDL3/SDL_haptic.h 1440:34

Since: 3.2.0

playHapticRumbleSafe Source #

Arguments

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

Run a simple rumble effect on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
initHapticRumble, stopHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_PlayHapticRumble. The unsafe flavor is playHapticRumble .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_PlayHapticRumble, defined at SDL3/SDL_haptic.h 1440:34

Since: 3.2.0

stopHapticRumble Source #

Arguments

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

Stop the simple rumble on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
playHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_StopHapticRumble. The safe flavor is stopHapticRumbleSafe .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticRumble, defined at SDL3/SDL_haptic.h 1453:34

Since: 3.2.0

stopHapticRumbleSafe Source #

Arguments

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

Stop the simple rumble on a haptic device.

Returns
true on success or false on failure; call getError for more information.
See also
playHapticRumble

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_StopHapticRumble. The unsafe flavor is stopHapticRumble .
Scalars
The binding generation has mapped C scalars to native Haskell scalars for this function. Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
C declaration
SDL_StopHapticRumble, defined at SDL3/SDL_haptic.h 1453:34

Since: 3.2.0