| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Haptic
Contents
Description
The SDL haptic subsystem manages haptic (force feedback) devices.
The basic usage is as follows:
- Initialize the subsystem (SDL_INIT_HAPTIC).
- Open a haptic device.
to open from index.openHapticto open from an existing joystick.openHapticFromJoystick- Create an effect (
SDL_HapticEffect). - Upload the effect with
.createHapticEffect - Run the effect with
.runHapticEffect - (optional) Free the effect with
.destroyHapticEffect - Close the haptic device with
.closeHaptic
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
- module SDL3.Sys.Bindgen.Haptic
- pattern SDL_HAPTIC_POLAR :: SDL_HapticDirectionType
- pattern SDL_HAPTIC_CARTESIAN :: SDL_HapticDirectionType
- pattern SDL_HAPTIC_SPHERICAL :: SDL_HapticDirectionType
- pattern SDL_HAPTIC_STEERING_AXIS :: SDL_HapticDirectionType
- pattern SDL_HAPTIC_CONSTANT :: SDL_HapticEffectType
- pattern SDL_HAPTIC_SINE :: SDL_HapticEffectType
- pattern SDL_HAPTIC_SQUARE :: SDL_HapticEffectType
- pattern SDL_HAPTIC_TRIANGLE :: SDL_HapticEffectType
- pattern SDL_HAPTIC_SAWTOOTHUP :: SDL_HapticEffectType
- pattern SDL_HAPTIC_SAWTOOTHDOWN :: SDL_HapticEffectType
- pattern SDL_HAPTIC_RAMP :: SDL_HapticEffectType
- pattern SDL_HAPTIC_SPRING :: SDL_HapticEffectType
- pattern SDL_HAPTIC_DAMPER :: SDL_HapticEffectType
- pattern SDL_HAPTIC_INERTIA :: SDL_HapticEffectType
- pattern SDL_HAPTIC_FRICTION :: SDL_HapticEffectType
- pattern SDL_HAPTIC_LEFTRIGHT :: SDL_HapticEffectType
- pattern SDL_HAPTIC_RESERVED1 :: SDL_HapticEffectType
- pattern SDL_HAPTIC_RESERVED2 :: SDL_HapticEffectType
- pattern SDL_HAPTIC_RESERVED3 :: SDL_HapticEffectType
- pattern SDL_HAPTIC_CUSTOM :: SDL_HapticEffectType
- getHaptics :: Ptr CInt -> IO (Ptr SDL_HapticID)
- getHapticsSafe :: Ptr CInt -> IO (Ptr SDL_HapticID)
- getHapticNameForID :: SDL_HapticID -> IO (PtrConst CChar)
- getHapticNameForIDSafe :: SDL_HapticID -> IO (PtrConst CChar)
- openHaptic :: SDL_HapticID -> IO (Ptr SDL_Haptic)
- openHapticSafe :: SDL_HapticID -> IO (Ptr SDL_Haptic)
- getHapticFromID :: SDL_HapticID -> IO (Ptr SDL_Haptic)
- getHapticFromIDSafe :: SDL_HapticID -> IO (Ptr SDL_Haptic)
- getHapticID :: Ptr SDL_Haptic -> IO SDL_HapticID
- getHapticIDSafe :: Ptr SDL_Haptic -> IO SDL_HapticID
- getHapticName :: Ptr SDL_Haptic -> IO (PtrConst CChar)
- getHapticNameSafe :: Ptr SDL_Haptic -> IO (PtrConst CChar)
- isMouseHaptic :: IO Bool
- isMouseHapticSafe :: IO Bool
- openHapticFromMouse :: IO (Ptr SDL_Haptic)
- openHapticFromMouseSafe :: IO (Ptr SDL_Haptic)
- isJoystickHaptic :: Ptr SDL_Joystick -> IO Bool
- isJoystickHapticSafe :: Ptr SDL_Joystick -> IO Bool
- openHapticFromJoystick :: Ptr SDL_Joystick -> IO (Ptr SDL_Haptic)
- openHapticFromJoystickSafe :: Ptr SDL_Joystick -> IO (Ptr SDL_Haptic)
- closeHaptic :: Ptr SDL_Haptic -> IO ()
- closeHapticSafe :: Ptr SDL_Haptic -> IO ()
- getMaxHapticEffects :: Ptr SDL_Haptic -> IO Int32
- getMaxHapticEffectsSafe :: Ptr SDL_Haptic -> IO Int32
- getMaxHapticEffectsPlaying :: Ptr SDL_Haptic -> IO Int32
- getMaxHapticEffectsPlayingSafe :: Ptr SDL_Haptic -> IO Int32
- getHapticFeatures :: Ptr SDL_Haptic -> IO Word32
- getHapticFeaturesSafe :: Ptr SDL_Haptic -> IO Word32
- getNumHapticAxes :: Ptr SDL_Haptic -> IO Int32
- getNumHapticAxesSafe :: Ptr SDL_Haptic -> IO Int32
- hapticEffectSupported :: Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO Bool
- hapticEffectSupportedSafe :: Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO Bool
- createHapticEffect :: Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO SDL_HapticEffectID
- createHapticEffectSafe :: Ptr SDL_Haptic -> PtrConst SDL_HapticEffect -> IO SDL_HapticEffectID
- updateHapticEffect :: Ptr SDL_Haptic -> SDL_HapticEffectID -> PtrConst SDL_HapticEffect -> IO Bool
- updateHapticEffectSafe :: Ptr SDL_Haptic -> SDL_HapticEffectID -> PtrConst SDL_HapticEffect -> IO Bool
- runHapticEffect :: Ptr SDL_Haptic -> SDL_HapticEffectID -> Word32 -> IO Bool
- runHapticEffectSafe :: Ptr SDL_Haptic -> SDL_HapticEffectID -> Word32 -> IO Bool
- stopHapticEffect :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO Bool
- stopHapticEffectSafe :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO Bool
- destroyHapticEffect :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO ()
- destroyHapticEffectSafe :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO ()
- getHapticEffectStatus :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO Bool
- getHapticEffectStatusSafe :: Ptr SDL_Haptic -> SDL_HapticEffectID -> IO Bool
- setHapticGain :: Ptr SDL_Haptic -> Int32 -> IO Bool
- setHapticGainSafe :: Ptr SDL_Haptic -> Int32 -> IO Bool
- setHapticAutocenter :: Ptr SDL_Haptic -> Int32 -> IO Bool
- setHapticAutocenterSafe :: Ptr SDL_Haptic -> Int32 -> IO Bool
- pauseHaptic :: Ptr SDL_Haptic -> IO Bool
- pauseHapticSafe :: Ptr SDL_Haptic -> IO Bool
- resumeHaptic :: Ptr SDL_Haptic -> IO Bool
- resumeHapticSafe :: Ptr SDL_Haptic -> IO Bool
- stopHapticEffects :: Ptr SDL_Haptic -> IO Bool
- stopHapticEffectsSafe :: Ptr SDL_Haptic -> IO Bool
- hapticRumbleSupported :: Ptr SDL_Haptic -> IO Bool
- hapticRumbleSupportedSafe :: Ptr SDL_Haptic -> IO Bool
- initHapticRumble :: Ptr SDL_Haptic -> IO Bool
- initHapticRumbleSafe :: Ptr SDL_Haptic -> IO Bool
- playHapticRumble :: Ptr SDL_Haptic -> Float -> Word32 -> IO Bool
- playHapticRumbleSafe :: Ptr SDL_Haptic -> Float -> Word32 -> IO Bool
- stopHapticRumble :: Ptr SDL_Haptic -> IO Bool
- stopHapticRumbleSafe :: Ptr SDL_Haptic -> IO Bool
Documentation
module SDL3.Sys.Bindgen.Haptic
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
Arguments
| :: Ptr CInt |
|
| -> 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
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - See also
openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHaptics. The safe flavor isgetHapticsSafe. - C declaration
SDL_GetHaptics, defined atSDL3/SDL_haptic.h 975:44
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> 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
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - See also
openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHaptics. The unsafe flavor isgetHaptics. - C declaration
SDL_GetHaptics, defined atSDL3/SDL_haptic.h 975:44
Since: 3.2.0
Arguments
| :: SDL_HapticID |
|
| -> 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
getErrorfor more information. - See also
getHapticName,openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHapticNameForID. The safe flavor isgetHapticNameForIDSafe. - C declaration
SDL_GetHapticNameForID, defined atSDL3/SDL_haptic.h 992:42
Since: 3.2.0
getHapticNameForIDSafe Source #
Arguments
| :: SDL_HapticID |
|
| -> 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
getErrorfor more information. - See also
getHapticName,openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHapticNameForID. The unsafe flavor isgetHapticNameForID. - C declaration
SDL_GetHapticNameForID, defined atSDL3/SDL_haptic.h 992:42
Since: 3.2.0
Arguments
| :: SDL_HapticID |
|
| -> 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 and setHapticGain.setHapticAutocenter
- Returns
- the device identifier or NULL on failure; call
getErrorfor more information. - See also
closeHaptic,getHaptics,openHapticFromJoystick,openHapticFromMouse,setHapticAutocenter,setHapticGain
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_OpenHaptic. The safe flavor isopenHapticSafe. - C declaration
SDL_OpenHaptic, defined atSDL3/SDL_haptic.h 1017:42
Since: 3.2.0
Arguments
| :: SDL_HapticID |
|
| -> 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 and setHapticGain.setHapticAutocenter
- Returns
- the device identifier or NULL on failure; call
getErrorfor more information. - See also
closeHaptic,getHaptics,openHapticFromJoystick,openHapticFromMouse,setHapticAutocenter,setHapticGain
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_OpenHaptic. The unsafe flavor isopenHaptic. - C declaration
SDL_OpenHaptic, defined atSDL3/SDL_haptic.h 1017:42
Since: 3.2.0
Arguments
| :: SDL_HapticID |
|
| -> IO (Ptr SDL_Haptic) |
Get the SDL_Haptic associated with an instance ID, if it has been opened.
- Returns
- an
SDL_Hapticon success or NULL on failure or if it hasn't been opened yet; callgetErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHapticFromID. The safe flavor isgetHapticFromIDSafe. - C declaration
SDL_GetHapticFromID, defined atSDL3/SDL_haptic.h 1029:42
Since: 3.2.0
Arguments
| :: SDL_HapticID |
|
| -> IO (Ptr SDL_Haptic) |
Get the SDL_Haptic associated with an instance ID, if it has been opened.
- Returns
- an
SDL_Hapticon success or NULL on failure or if it hasn't been opened yet; callgetErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHapticFromID. The unsafe flavor isgetHapticFromID. - C declaration
SDL_GetHapticFromID, defined atSDL3/SDL_haptic.h 1029:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHapticID. The safe flavor isgetHapticIDSafe. - C declaration
SDL_GetHapticID, defined atSDL3/SDL_haptic.h 1040:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHapticID. The unsafe flavor isgetHapticID. - C declaration
SDL_GetHapticID, defined atSDL3/SDL_haptic.h 1040:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getHapticNameForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHapticName. The safe flavor isgetHapticNameSafe. - C declaration
SDL_GetHapticName, defined atSDL3/SDL_haptic.h 1054:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getHapticNameForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHapticName. The unsafe flavor isgetHapticName. - C declaration
SDL_GetHapticName, defined atSDL3/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
- FFI safety
- Unsafe foreign import of
SDL_IsMouseHaptic. The safe flavor isisMouseHapticSafe. - 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 atSDL3/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
- FFI safety
- Safe foreign import of
SDL_IsMouseHaptic. The unsafe flavor isisMouseHaptic. - 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 atSDL3/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
getErrorfor more information. - See also
closeHaptic,isMouseHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_OpenHapticFromMouse. The safe flavor isopenHapticFromMouseSafe. - C declaration
SDL_OpenHapticFromMouse, defined atSDL3/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
getErrorfor more information. - See also
closeHaptic,isMouseHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_OpenHapticFromMouse. The unsafe flavor isopenHapticFromMouse. - C declaration
SDL_OpenHapticFromMouse, defined atSDL3/SDL_haptic.h 1078:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> 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
- FFI safety
- Unsafe foreign import of
SDL_IsJoystickHaptic. The safe flavor isisJoystickHapticSafe. - 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 atSDL3/SDL_haptic.h 1090:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Joystick |
|
| -> 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
- FFI safety
- Safe foreign import of
SDL_IsJoystickHaptic. The unsafe flavor isisJoystickHaptic. - 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 atSDL3/SDL_haptic.h 1090:34
Since: 3.2.0
openHapticFromJoystick Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> 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
getErrorfor more information. - See also
closeHaptic,isJoystickHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_OpenHapticFromJoystick. The safe flavor isopenHapticFromJoystickSafe. - C declaration
SDL_OpenHapticFromJoystick, defined atSDL3/SDL_haptic.h 1112:42
Since: 3.2.0
openHapticFromJoystickSafe Source #
Arguments
| :: Ptr SDL_Joystick |
|
| -> 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
getErrorfor more information. - See also
closeHaptic,isJoystickHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_OpenHapticFromJoystick. The unsafe flavor isopenHapticFromJoystick. - C declaration
SDL_OpenHapticFromJoystick, defined atSDL3/SDL_haptic.h 1112:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO () |
Close a haptic device previously opened with .openHaptic
- See also
openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CloseHaptic. The safe flavor iscloseHapticSafe. - C declaration
SDL_CloseHaptic, defined atSDL3/SDL_haptic.h 1123:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO () |
Close a haptic device previously opened with .openHaptic
- See also
openHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CloseHaptic. The unsafe flavor iscloseHaptic. - C declaration
SDL_CloseHaptic, defined atSDL3/SDL_haptic.h 1123:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getMaxHapticEffectsPlaying,getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetMaxHapticEffects. The safe flavor isgetMaxHapticEffectsSafe. - 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 atSDL3/SDL_haptic.h 1141:33
Since: 3.2.0
getMaxHapticEffectsSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getMaxHapticEffectsPlaying,getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetMaxHapticEffects. The unsafe flavor isgetMaxHapticEffects. - 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 atSDL3/SDL_haptic.h 1141:33
Since: 3.2.0
getMaxHapticEffectsPlaying Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getMaxHapticEffects,getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetMaxHapticEffectsPlaying. The safe flavor isgetMaxHapticEffectsPlayingSafe. - 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 atSDL3/SDL_haptic.h 1157:33
Since: 3.2.0
getMaxHapticEffectsPlayingSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
getMaxHapticEffects,getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetMaxHapticEffectsPlaying. The unsafe flavor isgetMaxHapticEffectsPlaying. - 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 atSDL3/SDL_haptic.h 1157:33
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
hapticEffectSupported,getMaxHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetHapticFeatures. The safe flavor isgetHapticFeaturesSafe. - 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 atSDL3/SDL_haptic.h 1171:36
Since: 3.2.0
getHapticFeaturesSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information. - See also
hapticEffectSupported,getMaxHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetHapticFeatures. The unsafe flavor isgetHapticFeatures. - 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 atSDL3/SDL_haptic.h 1171:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetNumHapticAxes. The safe flavor isgetNumHapticAxesSafe. - 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 atSDL3/SDL_haptic.h 1185:33
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
getErrorfor more information.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetNumHapticAxes. The unsafe flavor isgetNumHapticAxes. - 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 atSDL3/SDL_haptic.h 1185:33
Since: 3.2.0
hapticEffectSupported Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
- FFI safety
- Unsafe foreign import of
SDL_HapticEffectSupported. The safe flavor ishapticEffectSupportedSafe. - 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 atSDL3/SDL_haptic.h 1199:34
Since: 3.2.0
hapticEffectSupportedSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
- FFI safety
- Safe foreign import of
SDL_HapticEffectSupported. The unsafe flavor ishapticEffectSupported. - 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 atSDL3/SDL_haptic.h 1199:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
getErrorfor more information. - See also
destroyHapticEffect,runHapticEffect,updateHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CreateHapticEffect. The safe flavor iscreateHapticEffectSafe. - C declaration
SDL_CreateHapticEffect, defined atSDL3/SDL_haptic.h 1216:48
Since: 3.2.0
createHapticEffectSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
getErrorfor more information. - See also
destroyHapticEffect,runHapticEffect,updateHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CreateHapticEffect. The unsafe flavor iscreateHapticEffect. - C declaration
SDL_CreateHapticEffect, defined atSDL3/SDL_haptic.h 1216:48
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
getErrorfor more information. - See also
createHapticEffect,runHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_UpdateHapticEffect. The safe flavor isupdateHapticEffectSafe. - 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 atSDL3/SDL_haptic.h 1238:34
Since: 3.2.0
updateHapticEffectSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> PtrConst SDL_HapticEffect |
|
| -> 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
getErrorfor more information. - See also
createHapticEffect,runHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_UpdateHapticEffect. The unsafe flavor isupdateHapticEffect. - 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 atSDL3/SDL_haptic.h 1238:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> Word32 |
|
| -> IO Bool |
Run the haptic effect on its associated haptic device.
To repeat the effect over and over indefinitely, set iterations to . (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 sDL_HAPTIC_INFINITYlength in its structure/union to instead.sDL_HAPTIC_INFINITY
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
getHapticEffectStatus,stopHapticEffect,stopHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_RunHapticEffect. The safe flavor isrunHapticEffectSafe. - 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 atSDL3/SDL_haptic.h 1262:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> Word32 |
|
| -> IO Bool |
Run the haptic effect on its associated haptic device.
To repeat the effect over and over indefinitely, set iterations to . (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 sDL_HAPTIC_INFINITYlength in its structure/union to instead.sDL_HAPTIC_INFINITY
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
getHapticEffectStatus,stopHapticEffect,stopHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_RunHapticEffect. The unsafe flavor isrunHapticEffect. - 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 atSDL3/SDL_haptic.h 1262:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> IO Bool |
Stop the haptic effect on its associated haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
runHapticEffect,stopHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StopHapticEffect. The safe flavor isstopHapticEffectSafe. - 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 atSDL3/SDL_haptic.h 1277:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> IO Bool |
Stop the haptic effect on its associated haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
runHapticEffect,stopHapticEffects
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StopHapticEffect. The unsafe flavor isstopHapticEffect. - 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 atSDL3/SDL_haptic.h 1277:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> 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
- FFI safety
- Unsafe foreign import of
SDL_DestroyHapticEffect. The safe flavor isdestroyHapticEffectSafe. - C declaration
SDL_DestroyHapticEffect, defined atSDL3/SDL_haptic.h 1292:34
Since: 3.2.0
destroyHapticEffectSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> 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
- FFI safety
- Safe foreign import of
SDL_DestroyHapticEffect. The unsafe flavor isdestroyHapticEffect. - C declaration
SDL_DestroyHapticEffect, defined atSDL3/SDL_haptic.h 1292:34
Since: 3.2.0
getHapticEffectStatus Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> 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
- FFI safety
- Unsafe foreign import of
SDL_GetHapticEffectStatus. The safe flavor isgetHapticEffectStatusSafe. - 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 atSDL3/SDL_haptic.h 1308:34
Since: 3.2.0
getHapticEffectStatusSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> SDL_HapticEffectID |
|
| -> 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
- FFI safety
- Safe foreign import of
SDL_GetHapticEffectStatus. The unsafe flavor isgetHapticEffectStatus. - 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 atSDL3/SDL_haptic.h 1308:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> Int32 |
|
| -> 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 will scale linearly using setHapticGainSDL_HAPTIC_GAIN_MAX as the maximum.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetHapticGain. The safe flavor issetHapticGainSafe. - 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 atSDL3/SDL_haptic.h 1330:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> Int32 |
|
| -> 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 will scale linearly using setHapticGainSDL_HAPTIC_GAIN_MAX as the maximum.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetHapticGain. The unsafe flavor issetHapticGain. - 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 atSDL3/SDL_haptic.h 1330:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> Int32 |
|
| -> 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
getErrorfor more information. - See also
getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetHapticAutocenter. The safe flavor issetHapticAutocenterSafe. - 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 atSDL3/SDL_haptic.h 1349:34
Since: 3.2.0
setHapticAutocenterSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> Int32 |
|
| -> 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
getErrorfor more information. - See also
getHapticFeatures
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetHapticAutocenter. The unsafe flavor issetHapticAutocenter. - 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 atSDL3/SDL_haptic.h 1349:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Pause a haptic device.
Device must support the feature. Call sDL_HAPTIC_PAUSE to resume playback.resumeHaptic
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
getErrorfor more information. - See also
resumeHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_PauseHaptic. The safe flavor ispauseHapticSafe. - 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 atSDL3/SDL_haptic.h 1368:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Pause a haptic device.
Device must support the feature. Call sDL_HAPTIC_PAUSE to resume playback.resumeHaptic
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
getErrorfor more information. - See also
resumeHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_PauseHaptic. The unsafe flavor ispauseHaptic. - 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 atSDL3/SDL_haptic.h 1368:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Resume a haptic device.
Call to unpause after .pauseHaptic
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
pauseHaptic
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ResumeHaptic. The safe flavor isresumeHapticSafe. - 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 atSDL3/SDL_haptic.h 1383:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Resume a haptic device.
Call to unpause after .pauseHaptic
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
pauseHaptic
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ResumeHaptic. The unsafe flavor isresumeHaptic. - 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 atSDL3/SDL_haptic.h 1383:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Stop all the currently playing effects on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
runHapticEffect,stopHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StopHapticEffects. The safe flavor isstopHapticEffectsSafe. - 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 atSDL3/SDL_haptic.h 1397:34
Since: 3.2.0
stopHapticEffectsSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Stop all the currently playing effects on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
runHapticEffect,stopHapticEffect
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StopHapticEffects. The unsafe flavor isstopHapticEffects. - 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 atSDL3/SDL_haptic.h 1397:34
Since: 3.2.0
hapticRumbleSupported Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
- FFI safety
- Unsafe foreign import of
SDL_HapticRumbleSupported. The safe flavor ishapticRumbleSupportedSafe. - 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 atSDL3/SDL_haptic.h 1409:34
Since: 3.2.0
hapticRumbleSupportedSafe Source #
Arguments
| :: Ptr SDL_Haptic |
|
| -> 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
- FFI safety
- Safe foreign import of
SDL_HapticRumbleSupported. The unsafe flavor ishapticRumbleSupported. - 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 atSDL3/SDL_haptic.h 1409:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Initialize a haptic device for simple rumble playback.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
playHapticRumble,stopHapticRumble,hapticRumbleSupported
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_InitHapticRumble. The safe flavor isinitHapticRumbleSafe. - 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 atSDL3/SDL_haptic.h 1424:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Initialize a haptic device for simple rumble playback.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
playHapticRumble,stopHapticRumble,hapticRumbleSupported
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_InitHapticRumble. The unsafe flavor isinitHapticRumble. - 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 atSDL3/SDL_haptic.h 1424:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> Float |
|
| -> Word32 |
|
| -> IO Bool |
Run a simple rumble effect on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
initHapticRumble,stopHapticRumble
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_PlayHapticRumble. The safe flavor isplayHapticRumbleSafe. - 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 atSDL3/SDL_haptic.h 1440:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> Float |
|
| -> Word32 |
|
| -> IO Bool |
Run a simple rumble effect on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
initHapticRumble,stopHapticRumble
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_PlayHapticRumble. The unsafe flavor isplayHapticRumble. - 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 atSDL3/SDL_haptic.h 1440:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Stop the simple rumble on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
playHapticRumble
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_StopHapticRumble. The safe flavor isstopHapticRumbleSafe. - 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 atSDL3/SDL_haptic.h 1453:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Haptic |
|
| -> IO Bool |
Stop the simple rumble on a haptic device.
- Returns
- true on success or false on failure; call
getErrorfor more information. - See also
playHapticRumble
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_StopHapticRumble. The unsafe flavor isstopHapticRumble. - 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 atSDL3/SDL_haptic.h 1453:34
Since: 3.2.0