| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Gamepad
Contents
Description
SDL provides a low-level joystick API, which just treats joysticks as an arbitrary pile of buttons, axes, and hat switches. If you're planning to write your own control configuration screen, this can give you a lot of flexibility, but that's a lot of work, and most things that we consider "joysticks" now are actually console-style gamepads. So SDL provides the gamepad API on top of the lower-level joystick functionality.
The difference between a joystick and a gamepad is that a gamepad tells you where a button or axis is on the device. You don't speak to gamepads in terms of arbitrary numbers like "button 3" or "axis 2" but in standard locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or X/O/Square/Triangle, if you will).
One turns a joystick into a gamepad by providing a magic configuration string, which tells SDL the details of a specific device: when you see this specific hardware, if button 2 gets pressed, this is actually D-Pad Up, etc.
SDL has many popular controllers configured out of the box, and users can add their own controller details through an environment variable if it's otherwise unknown to SDL.
In order to use these functions, init must have been called with the SDL_INIT_GAMEPAD flag. This causes SDL to scan the system for gamepads, and load appropriate drivers.
If you're using SDL gamepad support in a Steam game, you must call SteamAPI_InitEx() before calling init.
If you would like to receive gamepad updates while the application is in the background, you should set the following hint before calling init: SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
Gamepads support various optional features such as rumble, color LEDs, touchpad, gyro, etc. The support for these features varies depending on the controller and OS support available. You can check for LED and rumble capabilities at runtime by calling and checking the various capability properties. You can check for touchpad by calling getGamepadProperties and check for gyro and accelerometer by calling getNumGamepadTouchpads.gamepadHasSensor
By default SDL will try to use the most capable driver available, but you can tune which OS drivers to use with the various joystick hints in SDL_hints.h.
Your application should always support gamepad hotplugging. On some platforms like Xbox, Steam Deck, etc., this is a requirement for certification. On other platforms, like macOS and Windows when using Windows.Gaming.Input, controllers may not be available at startup and will come in at some point after you've started processing events. The structure used to identify an SDL gamepad
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.Gamepad.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.Gamepad
- addGamepadMapping :: PtrConst CChar -> IO Int32
- addGamepadMappingSafe :: PtrConst CChar -> IO Int32
- addGamepadMappingsFromIO :: Ptr SDL_IOStream -> Bool -> IO Int32
- addGamepadMappingsFromIOSafe :: Ptr SDL_IOStream -> Bool -> IO Int32
- addGamepadMappingsFromFile :: PtrConst CChar -> IO Int32
- addGamepadMappingsFromFileSafe :: PtrConst CChar -> IO Int32
- reloadGamepadMappings :: IO Bool
- reloadGamepadMappingsSafe :: IO Bool
- getGamepadMappings :: Ptr CInt -> IO (Ptr (Ptr CChar))
- getGamepadMappingsSafe :: Ptr CInt -> IO (Ptr (Ptr CChar))
- getGamepadMappingForGUID :: SDL_GUID -> IO (Ptr CChar)
- getGamepadMappingForGUIDSafe :: SDL_GUID -> IO (Ptr CChar)
- getGamepadMapping :: Ptr SDL_Gamepad -> IO (Ptr CChar)
- getGamepadMappingSafe :: Ptr SDL_Gamepad -> IO (Ptr CChar)
- setGamepadMapping :: SDL_JoystickID -> PtrConst CChar -> IO Bool
- setGamepadMappingSafe :: SDL_JoystickID -> PtrConst CChar -> IO Bool
- hasGamepad :: IO Bool
- hasGamepadSafe :: IO Bool
- getGamepads :: Ptr CInt -> IO (Ptr SDL_JoystickID)
- getGamepadsSafe :: Ptr CInt -> IO (Ptr SDL_JoystickID)
- isGamepad :: SDL_JoystickID -> IO Bool
- isGamepadSafe :: SDL_JoystickID -> IO Bool
- getGamepadNameForID :: SDL_JoystickID -> IO (PtrConst CChar)
- getGamepadNameForIDSafe :: SDL_JoystickID -> IO (PtrConst CChar)
- getGamepadPathForID :: SDL_JoystickID -> IO (PtrConst CChar)
- getGamepadPathForIDSafe :: SDL_JoystickID -> IO (PtrConst CChar)
- getGamepadPlayerIndexForID :: SDL_JoystickID -> IO Int32
- getGamepadPlayerIndexForIDSafe :: SDL_JoystickID -> IO Int32
- getGamepadGUIDForID :: SDL_JoystickID -> IO SDL_GUID
- getGamepadGUIDForIDSafe :: SDL_JoystickID -> IO SDL_GUID
- getGamepadVendorForID :: SDL_JoystickID -> IO Word16
- getGamepadVendorForIDSafe :: SDL_JoystickID -> IO Word16
- getGamepadProductForID :: SDL_JoystickID -> IO Word16
- getGamepadProductForIDSafe :: SDL_JoystickID -> IO Word16
- getGamepadProductVersionForID :: SDL_JoystickID -> IO Word16
- getGamepadProductVersionForIDSafe :: SDL_JoystickID -> IO Word16
- getGamepadTypeForID :: SDL_JoystickID -> IO SDL_GamepadType
- getGamepadTypeForIDSafe :: SDL_JoystickID -> IO SDL_GamepadType
- getRealGamepadTypeForID :: SDL_JoystickID -> IO SDL_GamepadType
- getRealGamepadTypeForIDSafe :: SDL_JoystickID -> IO SDL_GamepadType
- getGamepadMappingForID :: SDL_JoystickID -> IO (Ptr CChar)
- getGamepadMappingForIDSafe :: SDL_JoystickID -> IO (Ptr CChar)
- openGamepad :: SDL_JoystickID -> IO (Ptr SDL_Gamepad)
- openGamepadSafe :: SDL_JoystickID -> IO (Ptr SDL_Gamepad)
- getGamepadFromID :: SDL_JoystickID -> IO (Ptr SDL_Gamepad)
- getGamepadFromIDSafe :: SDL_JoystickID -> IO (Ptr SDL_Gamepad)
- getGamepadFromPlayerIndex :: Int32 -> IO (Ptr SDL_Gamepad)
- getGamepadFromPlayerIndexSafe :: Int32 -> IO (Ptr SDL_Gamepad)
- getGamepadProperties :: Ptr SDL_Gamepad -> IO SDL_PropertiesID
- getGamepadPropertiesSafe :: Ptr SDL_Gamepad -> IO SDL_PropertiesID
- getGamepadID :: Ptr SDL_Gamepad -> IO SDL_JoystickID
- getGamepadIDSafe :: Ptr SDL_Gamepad -> IO SDL_JoystickID
- getGamepadName :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadNameSafe :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadPath :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadPathSafe :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadType :: Ptr SDL_Gamepad -> IO SDL_GamepadType
- getGamepadTypeSafe :: Ptr SDL_Gamepad -> IO SDL_GamepadType
- getRealGamepadType :: Ptr SDL_Gamepad -> IO SDL_GamepadType
- getRealGamepadTypeSafe :: Ptr SDL_Gamepad -> IO SDL_GamepadType
- getGamepadPlayerIndex :: Ptr SDL_Gamepad -> IO Int32
- getGamepadPlayerIndexSafe :: Ptr SDL_Gamepad -> IO Int32
- setGamepadPlayerIndex :: Ptr SDL_Gamepad -> Int32 -> IO Bool
- setGamepadPlayerIndexSafe :: Ptr SDL_Gamepad -> Int32 -> IO Bool
- getGamepadVendor :: Ptr SDL_Gamepad -> IO Word16
- getGamepadVendorSafe :: Ptr SDL_Gamepad -> IO Word16
- getGamepadProduct :: Ptr SDL_Gamepad -> IO Word16
- getGamepadProductSafe :: Ptr SDL_Gamepad -> IO Word16
- getGamepadProductVersion :: Ptr SDL_Gamepad -> IO Word16
- getGamepadProductVersionSafe :: Ptr SDL_Gamepad -> IO Word16
- getGamepadFirmwareVersion :: Ptr SDL_Gamepad -> IO Word16
- getGamepadFirmwareVersionSafe :: Ptr SDL_Gamepad -> IO Word16
- getGamepadSerial :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadSerialSafe :: Ptr SDL_Gamepad -> IO (PtrConst CChar)
- getGamepadSteamHandle :: Ptr SDL_Gamepad -> IO Word64
- getGamepadSteamHandleSafe :: Ptr SDL_Gamepad -> IO Word64
- getGamepadConnectionState :: Ptr SDL_Gamepad -> IO SDL_JoystickConnectionState
- getGamepadConnectionStateSafe :: Ptr SDL_Gamepad -> IO SDL_JoystickConnectionState
- getGamepadPowerInfo :: Ptr SDL_Gamepad -> Ptr CInt -> IO SDL_PowerState
- getGamepadPowerInfoSafe :: Ptr SDL_Gamepad -> Ptr CInt -> IO SDL_PowerState
- gamepadConnected :: Ptr SDL_Gamepad -> IO Bool
- gamepadConnectedSafe :: Ptr SDL_Gamepad -> IO Bool
- getGamepadJoystick :: Ptr SDL_Gamepad -> IO (Ptr SDL_Joystick)
- getGamepadJoystickSafe :: Ptr SDL_Gamepad -> IO (Ptr SDL_Joystick)
- setGamepadEventsEnabled :: Bool -> IO ()
- setGamepadEventsEnabledSafe :: Bool -> IO ()
- gamepadEventsEnabled :: IO Bool
- gamepadEventsEnabledSafe :: IO Bool
- getGamepadBindings :: Ptr SDL_Gamepad -> Ptr CInt -> IO (Ptr (Ptr SDL_GamepadBinding))
- getGamepadBindingsSafe :: Ptr SDL_Gamepad -> Ptr CInt -> IO (Ptr (Ptr SDL_GamepadBinding))
- updateGamepads :: IO ()
- updateGamepadsSafe :: IO ()
- getGamepadTypeFromString :: PtrConst CChar -> IO SDL_GamepadType
- getGamepadTypeFromStringSafe :: PtrConst CChar -> IO SDL_GamepadType
- getGamepadStringForType :: SDL_GamepadType -> IO (PtrConst CChar)
- getGamepadStringForTypeSafe :: SDL_GamepadType -> IO (PtrConst CChar)
- getGamepadAxisFromString :: PtrConst CChar -> IO SDL_GamepadAxis
- getGamepadAxisFromStringSafe :: PtrConst CChar -> IO SDL_GamepadAxis
- getGamepadStringForAxis :: SDL_GamepadAxis -> IO (PtrConst CChar)
- getGamepadStringForAxisSafe :: SDL_GamepadAxis -> IO (PtrConst CChar)
- gamepadHasAxis :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO Bool
- gamepadHasAxisSafe :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO Bool
- getGamepadAxis :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO Int16
- getGamepadAxisSafe :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO Int16
- getGamepadButtonFromString :: PtrConst CChar -> IO SDL_GamepadButton
- getGamepadButtonFromStringSafe :: PtrConst CChar -> IO SDL_GamepadButton
- getGamepadStringForButton :: SDL_GamepadButton -> IO (PtrConst CChar)
- getGamepadStringForButtonSafe :: SDL_GamepadButton -> IO (PtrConst CChar)
- gamepadHasButton :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO Bool
- gamepadHasButtonSafe :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO Bool
- getGamepadButton :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO Bool
- getGamepadButtonSafe :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO Bool
- getGamepadButtonLabelForType :: SDL_GamepadType -> SDL_GamepadButton -> IO SDL_GamepadButtonLabel
- getGamepadButtonLabelForTypeSafe :: SDL_GamepadType -> SDL_GamepadButton -> IO SDL_GamepadButtonLabel
- getGamepadButtonLabel :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO SDL_GamepadButtonLabel
- getGamepadButtonLabelSafe :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO SDL_GamepadButtonLabel
- getNumGamepadTouchpads :: Ptr SDL_Gamepad -> IO Int32
- getNumGamepadTouchpadsSafe :: Ptr SDL_Gamepad -> IO Int32
- getNumGamepadTouchpadFingers :: Ptr SDL_Gamepad -> Int32 -> IO Int32
- getNumGamepadTouchpadFingersSafe :: Ptr SDL_Gamepad -> Int32 -> IO Int32
- getGamepadTouchpadFinger :: Ptr SDL_Gamepad -> Int32 -> Int32 -> Ptr CBool -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO Bool
- getGamepadTouchpadFingerSafe :: Ptr SDL_Gamepad -> Int32 -> Int32 -> Ptr CBool -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO Bool
- gamepadHasSensor :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Bool
- gamepadHasSensorSafe :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Bool
- setGamepadSensorEnabled :: Ptr SDL_Gamepad -> SDL_SensorType -> Bool -> IO Bool
- setGamepadSensorEnabledSafe :: Ptr SDL_Gamepad -> SDL_SensorType -> Bool -> IO Bool
- gamepadSensorEnabled :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Bool
- gamepadSensorEnabledSafe :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Bool
- getGamepadSensorDataRate :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Float
- getGamepadSensorDataRateSafe :: Ptr SDL_Gamepad -> SDL_SensorType -> IO Float
- getGamepadSensorData :: Ptr SDL_Gamepad -> SDL_SensorType -> Ptr CFloat -> Int32 -> IO Bool
- getGamepadSensorDataSafe :: Ptr SDL_Gamepad -> SDL_SensorType -> Ptr CFloat -> Int32 -> IO Bool
- rumbleGamepad :: Ptr SDL_Gamepad -> Word16 -> Word16 -> Word32 -> IO Bool
- rumbleGamepadSafe :: Ptr SDL_Gamepad -> Word16 -> Word16 -> Word32 -> IO Bool
- rumbleGamepadTriggers :: Ptr SDL_Gamepad -> Word16 -> Word16 -> Word32 -> IO Bool
- rumbleGamepadTriggersSafe :: Ptr SDL_Gamepad -> Word16 -> Word16 -> Word32 -> IO Bool
- setGamepadLED :: Ptr SDL_Gamepad -> Word8 -> Word8 -> Word8 -> IO Bool
- setGamepadLEDSafe :: Ptr SDL_Gamepad -> Word8 -> Word8 -> Word8 -> IO Bool
- sendGamepadEffect :: Ptr SDL_Gamepad -> PtrConst Void -> Int32 -> IO Bool
- sendGamepadEffectSafe :: Ptr SDL_Gamepad -> PtrConst Void -> Int32 -> IO Bool
- closeGamepad :: Ptr SDL_Gamepad -> IO ()
- closeGamepadSafe :: Ptr SDL_Gamepad -> IO ()
- getGamepadAppleSFSymbolsNameForButton :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO (PtrConst CChar)
- getGamepadAppleSFSymbolsNameForButtonSafe :: Ptr SDL_Gamepad -> SDL_GamepadButton -> IO (PtrConst CChar)
- getGamepadAppleSFSymbolsNameForAxis :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO (PtrConst CChar)
- getGamepadAppleSFSymbolsNameForAxisSafe :: Ptr SDL_Gamepad -> SDL_GamepadAxis -> IO (PtrConst CChar)
Documentation
module SDL3.Sys.Bindgen.Gamepad
Function aliases
Add support for gamepads that SDL is unaware of or change the binding of an existing gamepad.
The mapping string has the format "GUID,name,mapping", where GUID is the string value from guidToString, name is the human readable string for the device and mappings are gamepad mappings to joystick ones. Under Windows there is a reserved GUID of "xinput" that covers all XInput devices. The mapping format for joystick is:
bX: a joystick button, index XhX.Y: hat X with value YaX: axis X of the joystick
Buttons can be used as a gamepad axes and vice versa.
If a device with this GUID is already plugged in, SDL will generate an SDL_EVENT_GAMEPAD_ADDED event.
This string shows an example of a valid mapping for a gamepad:
"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
- Returns
- 1 if a new mapping is added, 0 if an existing mapping is updated, -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMappingsFromFile,addGamepadMappingsFromIO,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_AddGamepadMapping. The safe flavor isaddGamepadMappingSafe. - 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_AddGamepadMapping, defined atSDL3/SDL_gamepad.h 347:33
Since: 3.2.0
addGamepadMappingSafe Source #
Add support for gamepads that SDL is unaware of or change the binding of an existing gamepad.
The mapping string has the format "GUID,name,mapping", where GUID is the string value from guidToString, name is the human readable string for the device and mappings are gamepad mappings to joystick ones. Under Windows there is a reserved GUID of "xinput" that covers all XInput devices. The mapping format for joystick is:
bX: a joystick button, index XhX.Y: hat X with value YaX: axis X of the joystick
Buttons can be used as a gamepad axes and vice versa.
If a device with this GUID is already plugged in, SDL will generate an SDL_EVENT_GAMEPAD_ADDED event.
This string shows an example of a valid mapping for a gamepad:
"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
- Returns
- 1 if a new mapping is added, 0 if an existing mapping is updated, -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMappingsFromFile,addGamepadMappingsFromIO,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_AddGamepadMapping. The unsafe flavor isaddGamepadMapping. - 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_AddGamepadMapping, defined atSDL3/SDL_gamepad.h 347:33
Since: 3.2.0
addGamepadMappingsFromIO Source #
Arguments
| :: Ptr SDL_IOStream |
|
| -> Bool |
|
| -> IO Int32 |
Load a set of gamepad mappings from an SDL_IOStream.
You can call this function several times, if needed, to load different database files.
If a new mapping is loaded for an already known gamepad GUID, the later version will overwrite the one currently loaded.
Any new mappings for already plugged in controllers will generate SDL_EVENT_GAMEPAD_ADDED events.
Mappings not belonging to the current platform or with no platform field specified will be ignored (i.e. mappings for Linux will be ignored in Windows, etc).
This function will load the text database entirely in memory before processing it, so take this into consideration if you are in a memory constrained environment.
- Returns
- the number of mappings added or -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,addGamepadMappingsFromFile,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_AddGamepadMappingsFromIO. The safe flavor isaddGamepadMappingsFromIOSafe. - 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_AddGamepadMappingsFromIO, defined atSDL3/SDL_gamepad.h 387:33
Since: 3.2.0
addGamepadMappingsFromIOSafe Source #
Arguments
| :: Ptr SDL_IOStream |
|
| -> Bool |
|
| -> IO Int32 |
Load a set of gamepad mappings from an SDL_IOStream.
You can call this function several times, if needed, to load different database files.
If a new mapping is loaded for an already known gamepad GUID, the later version will overwrite the one currently loaded.
Any new mappings for already plugged in controllers will generate SDL_EVENT_GAMEPAD_ADDED events.
Mappings not belonging to the current platform or with no platform field specified will be ignored (i.e. mappings for Linux will be ignored in Windows, etc).
This function will load the text database entirely in memory before processing it, so take this into consideration if you are in a memory constrained environment.
- Returns
- the number of mappings added or -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,addGamepadMappingsFromFile,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_AddGamepadMappingsFromIO. The unsafe flavor isaddGamepadMappingsFromIO. - 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_AddGamepadMappingsFromIO, defined atSDL3/SDL_gamepad.h 387:33
Since: 3.2.0
addGamepadMappingsFromFile Source #
Load a set of gamepad mappings from a file.
You can call this function several times, if needed, to load different database files.
If a new mapping is loaded for an already known gamepad GUID, the later version will overwrite the one currently loaded.
Any new mappings for already plugged in controllers will generate SDL_EVENT_GAMEPAD_ADDED events.
Mappings not belonging to the current platform or with no platform field specified will be ignored (i.e. mappings for Linux will be ignored in Windows, etc).
- Returns
- the number of mappings added or -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,addGamepadMappingsFromIO,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_AddGamepadMappingsFromFile. The safe flavor isaddGamepadMappingsFromFileSafe. - 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_AddGamepadMappingsFromFile, defined atSDL3/SDL_gamepad.h 421:33
Since: 3.2.0
addGamepadMappingsFromFileSafe Source #
Load a set of gamepad mappings from a file.
You can call this function several times, if needed, to load different database files.
If a new mapping is loaded for an already known gamepad GUID, the later version will overwrite the one currently loaded.
Any new mappings for already plugged in controllers will generate SDL_EVENT_GAMEPAD_ADDED events.
Mappings not belonging to the current platform or with no platform field specified will be ignored (i.e. mappings for Linux will be ignored in Windows, etc).
- Returns
- the number of mappings added or -1 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,addGamepadMappingsFromIO,getGamepadMapping,getGamepadMappingForGUID, SDL_HINT_GAMECONTROLLERCONFIG, SDL_HINT_GAMECONTROLLERCONFIG_FILE, SDL_EVENT_GAMEPAD_ADDED
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_AddGamepadMappingsFromFile. The unsafe flavor isaddGamepadMappingsFromFile. - 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_AddGamepadMappingsFromFile, defined atSDL3/SDL_gamepad.h 421:33
Since: 3.2.0
reloadGamepadMappings :: IO Bool Source #
Reinitialize the SDL mapping database to its initial state.
This will generate gamepad events as needed if device mappings change.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_ReloadGamepadMappings. The safe flavor isreloadGamepadMappingsSafe. - 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_ReloadGamepadMappings, defined atSDL3/SDL_gamepad.h 435:34
Since: 3.2.0
reloadGamepadMappingsSafe :: IO Bool Source #
Reinitialize the SDL mapping database to its initial state.
This will generate gamepad events as needed if device mappings change.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_ReloadGamepadMappings. The unsafe flavor isreloadGamepadMappings. - 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_ReloadGamepadMappings, defined atSDL3/SDL_gamepad.h 435:34
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr (Ptr CChar)) |
Get the current gamepad mappings.
- Returns
- an array of the mapping strings, NULL-terminated, or NULL on failure; call
getErrorfor more information. This is a single allocation that should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadMappings. The safe flavor isgetGamepadMappingsSafe. - C declaration
SDL_GetGamepadMappings, defined atSDL3/SDL_gamepad.h 451:37
Since: 3.2.0
getGamepadMappingsSafe Source #
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr (Ptr CChar)) |
Get the current gamepad mappings.
- Returns
- an array of the mapping strings, NULL-terminated, or NULL on failure; call
getErrorfor more information. This is a single allocation that should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadMappings. The unsafe flavor isgetGamepadMappings. - C declaration
SDL_GetGamepadMappings, defined atSDL3/SDL_gamepad.h 451:37
Since: 3.2.0
getGamepadMappingForGUID Source #
Arguments
| :: SDL_GUID |
|
| -> IO (Ptr CChar) |
Get the gamepad mapping string for a given GUID.
- Returns
- a mapping string or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
getJoystickGUIDForID,getJoystickGUID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadMappingForGUID. The safe flavor isgetGamepadMappingForGUIDSafe. - C declaration
SDL_GetGamepadMappingForGUID, defined atSDL3/SDL_gamepad.h 468:36
Since: 3.2.0
getGamepadMappingForGUIDSafe Source #
Arguments
| :: SDL_GUID |
|
| -> IO (Ptr CChar) |
Get the gamepad mapping string for a given GUID.
- Returns
- a mapping string or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
getJoystickGUIDForID,getJoystickGUID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadMappingForGUID. The unsafe flavor isgetGamepadMappingForGUID. - C declaration
SDL_GetGamepadMappingForGUID, defined atSDL3/SDL_gamepad.h 468:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (Ptr CChar) |
Get the current mapping of a gamepad.
Details about mappings are discussed with .addGamepadMapping
- Returns
- a string that has the gamepad's mapping or NULL if no mapping is available; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,getGamepadMappingForID,getGamepadMappingForGUID,setGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadMapping. The safe flavor isgetGamepadMappingSafe. - C declaration
SDL_GetGamepadMapping, defined atSDL3/SDL_gamepad.h 489:36
Since: 3.2.0
getGamepadMappingSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (Ptr CChar) |
Get the current mapping of a gamepad.
Details about mappings are discussed with .addGamepadMapping
- Returns
- a string that has the gamepad's mapping or NULL if no mapping is available; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,getGamepadMappingForID,getGamepadMappingForGUID,setGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadMapping. The unsafe flavor isgetGamepadMapping. - C declaration
SDL_GetGamepadMapping, defined atSDL3/SDL_gamepad.h 489:36
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Set the current mapping of a joystick or gamepad.
Details about mappings are discussed with .addGamepadMapping
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,getGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetGamepadMapping. The safe flavor issetGamepadMappingSafe. - 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_SetGamepadMapping, defined atSDL3/SDL_gamepad.h 509:34
Since: 3.2.0
setGamepadMappingSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> PtrConst CChar |
|
| -> IO Bool |
Set the current mapping of a joystick or gamepad.
Details about mappings are discussed with .addGamepadMapping
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
addGamepadMapping,getGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetGamepadMapping. The unsafe flavor issetGamepadMapping. - 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_SetGamepadMapping, defined atSDL3/SDL_gamepad.h 509:34
Since: 3.2.0
hasGamepad :: IO Bool Source #
Return whether a gamepad is currently connected.
- Returns
- true if a gamepad is connected, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_HasGamepad. The safe flavor ishasGamepadSafe. - 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_HasGamepad, defined atSDL3/SDL_gamepad.h 522:34
Since: 3.2.0
hasGamepadSafe :: IO Bool Source #
Return whether a gamepad is currently connected.
- Returns
- true if a gamepad is connected, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_HasGamepad. The unsafe flavor ishasGamepad. - 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_HasGamepad, defined atSDL3/SDL_gamepad.h 522:34
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr SDL_JoystickID) |
Get a list of currently connected gamepads.
- Returns
- a 0 terminated array of joystick instance IDs or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
hasGamepad,openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepads. The safe flavor isgetGamepadsSafe. - C declaration
SDL_GetGamepads, defined atSDL3/SDL_gamepad.h 540:46
Since: 3.2.0
Arguments
| :: Ptr CInt |
|
| -> IO (Ptr SDL_JoystickID) |
Get a list of currently connected gamepads.
- Returns
- a 0 terminated array of joystick instance IDs or NULL on failure; call
getErrorfor more information. This should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
hasGamepad,openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepads. The unsafe flavor isgetGamepads. - C declaration
SDL_GetGamepads, defined atSDL3/SDL_gamepad.h 540:46
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO Bool |
Check if the given joystick is supported by the gamepad interface.
- Returns
- true if the given joystick is supported by the gamepad interface, false if it isn't or it's an invalid index.
- Thread safety
- It is safe to call this function from any thread.
- See also
getJoysticks,openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_IsGamepad. The safe flavor isisGamepadSafe. - 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_IsGamepad, defined atSDL3/SDL_gamepad.h 556:34
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO Bool |
Check if the given joystick is supported by the gamepad interface.
- Returns
- true if the given joystick is supported by the gamepad interface, false if it isn't or it's an invalid index.
- Thread safety
- It is safe to call this function from any thread.
- See also
getJoysticks,openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_IsGamepad. The unsafe flavor isisGamepad. - 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_IsGamepad, defined atSDL3/SDL_gamepad.h 556:34
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent name of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the name of the selected gamepad. If no name can be found, this function returns NULL; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadName,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadNameForID. The safe flavor isgetGamepadNameForIDSafe. - C declaration
SDL_GetGamepadNameForID, defined atSDL3/SDL_gamepad.h 574:42
Since: 3.2.0
getGamepadNameForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent name of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the name of the selected gamepad. If no name can be found, this function returns NULL; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadName,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadNameForID. The unsafe flavor isgetGamepadNameForID. - C declaration
SDL_GetGamepadNameForID, defined atSDL3/SDL_gamepad.h 574:42
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent path of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the path of the selected gamepad. If no path can be found, this function returns NULL; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPath,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadPathForID. The safe flavor isgetGamepadPathForIDSafe. - C declaration
SDL_GetGamepadPathForID, defined atSDL3/SDL_gamepad.h 592:42
Since: 3.2.0
getGamepadPathForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (PtrConst CChar) |
Get the implementation dependent path of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the path of the selected gamepad. If no path can be found, this function returns NULL; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPath,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadPathForID. The unsafe flavor isgetGamepadPathForID. - C declaration
SDL_GetGamepadPathForID, defined atSDL3/SDL_gamepad.h 592:42
Since: 3.2.0
getGamepadPlayerIndexForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Int32 |
Get the player index of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the player index of a gamepad, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadPlayerIndexForID. The safe flavor isgetGamepadPlayerIndexForIDSafe. - 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_GetGamepadPlayerIndexForID, defined atSDL3/SDL_gamepad.h 609:33
Since: 3.2.0
getGamepadPlayerIndexForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Int32 |
Get the player index of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the player index of a gamepad, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadPlayerIndexForID. The unsafe flavor isgetGamepadPlayerIndexForID. - 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_GetGamepadPlayerIndexForID, defined atSDL3/SDL_gamepad.h 609:33
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GUID |
Get the implementation-dependent GUID of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the GUID of the selected gamepad. If called on an invalid index, this function returns a zero GUID.
- Thread safety
- It is safe to call this function from any thread.
- See also
guidToString,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadGUIDForID. The safe flavor isgetGamepadGUIDForIDSafe. - C declaration
SDL_GetGamepadGUIDForID, defined atSDL3/SDL_gamepad.h 627:38
Since: 3.2.0
getGamepadGUIDForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GUID |
Get the implementation-dependent GUID of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the GUID of the selected gamepad. If called on an invalid index, this function returns a zero GUID.
- Thread safety
- It is safe to call this function from any thread.
- See also
guidToString,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadGUIDForID. The unsafe flavor isgetGamepadGUIDForID. - C declaration
SDL_GetGamepadGUIDForID, defined atSDL3/SDL_gamepad.h 627:38
Since: 3.2.0
getGamepadVendorForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the USB vendor ID of a gamepad, if available.
This can be called before any gamepads are opened. If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadVendor,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadVendorForID. The safe flavor isgetGamepadVendorForIDSafe. - 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_GetGamepadVendorForID, defined atSDL3/SDL_gamepad.h 646:36
Since: 3.2.0
getGamepadVendorForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the USB vendor ID of a gamepad, if available.
This can be called before any gamepads are opened. If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadVendor,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadVendorForID. The unsafe flavor isgetGamepadVendorForID. - 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_GetGamepadVendorForID, defined atSDL3/SDL_gamepad.h 646:36
Since: 3.2.0
getGamepadProductForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the USB product ID of a gamepad, if available.
This can be called before any gamepads are opened. If the product ID isn't available this function returns 0.
- Returns
- the USB product ID of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProduct,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadProductForID. The safe flavor isgetGamepadProductForIDSafe. - 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_GetGamepadProductForID, defined atSDL3/SDL_gamepad.h 665:36
Since: 3.2.0
getGamepadProductForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the USB product ID of a gamepad, if available.
This can be called before any gamepads are opened. If the product ID isn't available this function returns 0.
- Returns
- the USB product ID of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProduct,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadProductForID. The unsafe flavor isgetGamepadProductForID. - 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_GetGamepadProductForID, defined atSDL3/SDL_gamepad.h 665:36
Since: 3.2.0
getGamepadProductVersionForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the product version of a gamepad, if available.
This can be called before any gamepads are opened. If the product version isn't available this function returns 0.
- Returns
- the product version of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductVersion,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadProductVersionForID. The safe flavor isgetGamepadProductVersionForIDSafe. - 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_GetGamepadProductVersionForID, defined atSDL3/SDL_gamepad.h 684:36
Since: 3.2.0
getGamepadProductVersionForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO Word16 |
Get the product version of a gamepad, if available.
This can be called before any gamepads are opened. If the product version isn't available this function returns 0.
- Returns
- the product version of the selected gamepad. If called on an invalid index, this function returns zero.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductVersion,getGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadProductVersionForID. The unsafe flavor isgetGamepadProductVersionForID. - 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_GetGamepadProductVersionForID, defined atSDL3/SDL_gamepad.h 684:36
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GamepadType |
Get the type of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the gamepad type.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadType,getGamepads,getRealGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadTypeForID. The safe flavor isgetGamepadTypeForIDSafe. - C declaration
SDL_GetGamepadTypeForID, defined atSDL3/SDL_gamepad.h 702:45
Since: 3.2.0
getGamepadTypeForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GamepadType |
Get the type of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the gamepad type.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadType,getGamepads,getRealGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadTypeForID. The unsafe flavor isgetGamepadTypeForID. - C declaration
SDL_GetGamepadTypeForID, defined atSDL3/SDL_gamepad.h 702:45
Since: 3.2.0
getRealGamepadTypeForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GamepadType |
Get the type of a gamepad, ignoring any mapping override.
This can be called before any gamepads are opened.
- Returns
- the gamepad type.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeForID,getGamepads,getRealGamepadType
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetRealGamepadTypeForID. The safe flavor isgetRealGamepadTypeForIDSafe. - C declaration
SDL_GetRealGamepadTypeForID, defined atSDL3/SDL_gamepad.h 720:45
Since: 3.2.0
getRealGamepadTypeForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO SDL_GamepadType |
Get the type of a gamepad, ignoring any mapping override.
This can be called before any gamepads are opened.
- Returns
- the gamepad type.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeForID,getGamepads,getRealGamepadType
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetRealGamepadTypeForID. The unsafe flavor isgetRealGamepadTypeForID. - C declaration
SDL_GetRealGamepadTypeForID, defined atSDL3/SDL_gamepad.h 720:45
Since: 3.2.0
getGamepadMappingForID Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr CChar) |
Get the mapping of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the mapping string. Returns NULL if no mapping is available. This should be freed with
freewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepads,getGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadMappingForID. The safe flavor isgetGamepadMappingForIDSafe. - C declaration
SDL_GetGamepadMappingForID, defined atSDL3/SDL_gamepad.h 738:36
Since: 3.2.0
getGamepadMappingForIDSafe Source #
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr CChar) |
Get the mapping of a gamepad.
This can be called before any gamepads are opened.
- Returns
- the mapping string. Returns NULL if no mapping is available. This should be freed with
freewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepads,getGamepadMapping
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadMappingForID. The unsafe flavor isgetGamepadMappingForID. - C declaration
SDL_GetGamepadMappingForID, defined atSDL3/SDL_gamepad.h 738:36
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Gamepad) |
Open a gamepad for use.
- Returns
- a gamepad identifier or NULL if an error occurred; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
closeGamepad,isGamepad
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_OpenGamepad. The safe flavor isopenGamepadSafe. - C declaration
SDL_OpenGamepad, defined atSDL3/SDL_gamepad.h 754:43
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Gamepad) |
Open a gamepad for use.
- Returns
- a gamepad identifier or NULL if an error occurred; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
closeGamepad,isGamepad
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_OpenGamepad. The unsafe flavor isopenGamepad. - C declaration
SDL_OpenGamepad, defined atSDL3/SDL_gamepad.h 754:43
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Gamepad) |
Get the SDL_Gamepad associated with a joystick instance ID, if it has been opened.
- Returns
- an
SDL_Gamepadon success or NULL on failure or if it hasn't been opened yet; callgetErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadFromID. The safe flavor isgetGamepadFromIDSafe. - C declaration
SDL_GetGamepadFromID, defined atSDL3/SDL_gamepad.h 768:43
Since: 3.2.0
Arguments
| :: SDL_JoystickID |
|
| -> IO (Ptr SDL_Gamepad) |
Get the SDL_Gamepad associated with a joystick instance ID, if it has been opened.
- Returns
- an
SDL_Gamepadon success or NULL on failure or if it hasn't been opened yet; callgetErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadFromID. The unsafe flavor isgetGamepadFromID. - C declaration
SDL_GetGamepadFromID, defined atSDL3/SDL_gamepad.h 768:43
Since: 3.2.0
getGamepadFromPlayerIndex Source #
Arguments
| :: Int32 |
|
| -> IO (Ptr SDL_Gamepad) |
Get the SDL_Gamepad associated with a player index.
- Returns
- the
SDL_Gamepadassociated with a player index. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex,setGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadFromPlayerIndex. The safe flavor isgetGamepadFromPlayerIndexSafe. - 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_GetGamepadFromPlayerIndex, defined atSDL3/SDL_gamepad.h 783:43
Since: 3.2.0
getGamepadFromPlayerIndexSafe Source #
Arguments
| :: Int32 |
|
| -> IO (Ptr SDL_Gamepad) |
Get the SDL_Gamepad associated with a player index.
- Returns
- the
SDL_Gamepadassociated with a player index. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex,setGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadFromPlayerIndex. The unsafe flavor isgetGamepadFromPlayerIndex. - 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_GetGamepadFromPlayerIndex, defined atSDL3/SDL_gamepad.h 783:43
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_PropertiesID |
Get the properties associated with an opened gamepad.
These properties are shared with the underlying joystick object.
The following read-only properties are provided by SDL:
: true if this gamepad has an LED that has adjustable brightnesssDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN: true if this gamepad has an LED that has adjustable colorsDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN: true if this gamepad has a player LEDsDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN: true if this gamepad has left/right rumblesDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN: true if this gamepad has simple trigger rumblesDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN
- Returns
- a valid property ID on success or 0 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadProperties. The safe flavor isgetGamepadPropertiesSafe. - C declaration
SDL_GetGamepadProperties, defined atSDL3/SDL_gamepad.h 812:46
Since: 3.2.0
getGamepadPropertiesSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_PropertiesID |
Get the properties associated with an opened gamepad.
These properties are shared with the underlying joystick object.
The following read-only properties are provided by SDL:
: true if this gamepad has an LED that has adjustable brightnesssDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN: true if this gamepad has an LED that has adjustable colorsDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN: true if this gamepad has a player LEDsDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN: true if this gamepad has left/right rumblesDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN: true if this gamepad has simple trigger rumblesDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN
- Returns
- a valid property ID on success or 0 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadProperties. The unsafe flavor isgetGamepadProperties. - C declaration
SDL_GetGamepadProperties, defined atSDL3/SDL_gamepad.h 812:46
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_JoystickID |
Get the instance ID of an opened gamepad.
- Returns
- the instance ID of the specified gamepad on success or 0 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadID. The safe flavor isgetGamepadIDSafe. - C declaration
SDL_GetGamepadID, defined atSDL3/SDL_gamepad.h 832:44
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_JoystickID |
Get the instance ID of an opened gamepad.
- Returns
- the instance ID of the specified gamepad on success or 0 on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadID. The unsafe flavor isgetGamepadID. - C declaration
SDL_GetGamepadID, defined atSDL3/SDL_gamepad.h 832:44
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the implementation-dependent name for an opened gamepad.
- Returns
- the implementation dependent name for the gamepad, or NULL if there is no name or the identifier passed is invalid.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadNameForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadName. The safe flavor isgetGamepadNameSafe. - C declaration
SDL_GetGamepadName, defined atSDL3/SDL_gamepad.h 848:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the implementation-dependent name for an opened gamepad.
- Returns
- the implementation dependent name for the gamepad, or NULL if there is no name or the identifier passed is invalid.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadNameForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadName. The unsafe flavor isgetGamepadName. - C declaration
SDL_GetGamepadName, defined atSDL3/SDL_gamepad.h 848:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the implementation-dependent path for an opened gamepad.
- Returns
- the implementation dependent path for the gamepad, or NULL if there is no path or the identifier passed is invalid.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPathForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadPath. The safe flavor isgetGamepadPathSafe. - C declaration
SDL_GetGamepadPath, defined atSDL3/SDL_gamepad.h 864:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the implementation-dependent path for an opened gamepad.
- Returns
- the implementation dependent path for the gamepad, or NULL if there is no path or the identifier passed is invalid.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPathForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadPath. The unsafe flavor isgetGamepadPath. - C declaration
SDL_GetGamepadPath, defined atSDL3/SDL_gamepad.h 864:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_GamepadType |
Get the type of an opened gamepad.
- Returns
- the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadType. The safe flavor isgetGamepadTypeSafe. - C declaration
SDL_GetGamepadType, defined atSDL3/SDL_gamepad.h 879:45
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_GamepadType |
Get the type of an opened gamepad.
- Returns
- the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadType. The unsafe flavor isgetGamepadType. - C declaration
SDL_GetGamepadType, defined atSDL3/SDL_gamepad.h 879:45
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_GamepadType |
Get the type of an opened gamepad, ignoring any mapping override.
- Returns
- the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getRealGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetRealGamepadType. The safe flavor isgetRealGamepadTypeSafe. - C declaration
SDL_GetRealGamepadType, defined atSDL3/SDL_gamepad.h 894:45
Since: 3.2.0
getRealGamepadTypeSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_GamepadType |
Get the type of an opened gamepad, ignoring any mapping override.
- Returns
- the gamepad type, or SDL_GAMEPAD_TYPE_UNKNOWN if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
getRealGamepadTypeForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetRealGamepadType. The unsafe flavor isgetRealGamepadType. - C declaration
SDL_GetRealGamepadType, defined atSDL3/SDL_gamepad.h 894:45
Since: 3.2.0
getGamepadPlayerIndex Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Int32 |
Get the player index of an opened gamepad.
For XInput gamepads this returns the XInput user index.
- Returns
- the player index for gamepad, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadPlayerIndex. The safe flavor isgetGamepadPlayerIndexSafe. - 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_GetGamepadPlayerIndex, defined atSDL3/SDL_gamepad.h 910:33
Since: 3.2.0
getGamepadPlayerIndexSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Int32 |
Get the player index of an opened gamepad.
For XInput gamepads this returns the XInput user index.
- Returns
- the player index for gamepad, or -1 if it's not available.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadPlayerIndex. The unsafe flavor isgetGamepadPlayerIndex. - 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_GetGamepadPlayerIndex, defined atSDL3/SDL_gamepad.h 910:33
Since: 3.2.0
setGamepadPlayerIndex Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> IO Bool |
Set the player index of an opened gamepad.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetGamepadPlayerIndex. The safe flavor issetGamepadPlayerIndexSafe. - 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_SetGamepadPlayerIndex, defined atSDL3/SDL_gamepad.h 927:34
Since: 3.2.0
setGamepadPlayerIndexSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> IO Bool |
Set the player index of an opened gamepad.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadPlayerIndex
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetGamepadPlayerIndex. The unsafe flavor issetGamepadPlayerIndex. - 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_SetGamepadPlayerIndex, defined atSDL3/SDL_gamepad.h 927:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the USB vendor ID of an opened gamepad, if available.
If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadVendorForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadVendor. The safe flavor isgetGamepadVendorSafe. - 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_GetGamepadVendor, defined atSDL3/SDL_gamepad.h 943:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the USB vendor ID of an opened gamepad, if available.
If the vendor ID isn't available this function returns 0.
- Returns
- the USB vendor ID, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadVendorForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadVendor. The unsafe flavor isgetGamepadVendor. - 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_GetGamepadVendor, defined atSDL3/SDL_gamepad.h 943:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the USB product ID of an opened gamepad, if available.
If the product ID isn't available this function returns 0.
- Returns
- the USB product ID, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadProduct. The safe flavor isgetGamepadProductSafe. - 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_GetGamepadProduct, defined atSDL3/SDL_gamepad.h 959:36
Since: 3.2.0
getGamepadProductSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the USB product ID of an opened gamepad, if available.
If the product ID isn't available this function returns 0.
- Returns
- the USB product ID, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadProduct. The unsafe flavor isgetGamepadProduct. - 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_GetGamepadProduct, defined atSDL3/SDL_gamepad.h 959:36
Since: 3.2.0
getGamepadProductVersion Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the product version of an opened gamepad, if available.
If the product version isn't available this function returns 0.
- Returns
- the USB product version, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductVersionForID
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadProductVersion. The safe flavor isgetGamepadProductVersionSafe. - 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_GetGamepadProductVersion, defined atSDL3/SDL_gamepad.h 975:36
Since: 3.2.0
getGamepadProductVersionSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the product version of an opened gamepad, if available.
If the product version isn't available this function returns 0.
- Returns
- the USB product version, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadProductVersionForID
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadProductVersion. The unsafe flavor isgetGamepadProductVersion. - 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_GetGamepadProductVersion, defined atSDL3/SDL_gamepad.h 975:36
Since: 3.2.0
getGamepadFirmwareVersion Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the firmware version of an opened gamepad, if available.
If the firmware version isn't available this function returns 0.
- Returns
- the gamepad firmware version, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadFirmwareVersion. The safe flavor isgetGamepadFirmwareVersionSafe. - 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_GetGamepadFirmwareVersion, defined atSDL3/SDL_gamepad.h 989:36
Since: 3.2.0
getGamepadFirmwareVersionSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word16 |
Get the firmware version of an opened gamepad, if available.
If the firmware version isn't available this function returns 0.
- Returns
- the gamepad firmware version, or zero if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadFirmwareVersion. The unsafe flavor isgetGamepadFirmwareVersion. - 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_GetGamepadFirmwareVersion, defined atSDL3/SDL_gamepad.h 989:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the serial number of an opened gamepad, if available.
Returns the serial number of the gamepad, or NULL if it is not available.
- Returns
- the serial number, or NULL if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadSerial. The safe flavor isgetGamepadSerialSafe. - C declaration
SDL_GetGamepadSerial, defined atSDL3/SDL_gamepad.h 1003:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (PtrConst CChar) |
Get the serial number of an opened gamepad, if available.
Returns the serial number of the gamepad, or NULL if it is not available.
- Returns
- the serial number, or NULL if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadSerial. The unsafe flavor isgetGamepadSerial. - C declaration
SDL_GetGamepadSerial, defined atSDL3/SDL_gamepad.h 1003:42
Since: 3.2.0
getGamepadSteamHandle Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word64 |
Get the Steam Input handle of an opened gamepad, if available.
Returns an InputHandle_t for the gamepad that can be used with Steam Input API: https://partner.steamgames.com/doc/api/ISteamInput
- Returns
- the gamepad handle, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadSteamHandle. The safe flavor isgetGamepadSteamHandleSafe. - 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_GetGamepadSteamHandle, defined atSDL3/SDL_gamepad.h 1018:36
Since: 3.2.0
getGamepadSteamHandleSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Word64 |
Get the Steam Input handle of an opened gamepad, if available.
Returns an InputHandle_t for the gamepad that can be used with Steam Input API: https://partner.steamgames.com/doc/api/ISteamInput
- Returns
- the gamepad handle, or 0 if unavailable.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadSteamHandle. The unsafe flavor isgetGamepadSteamHandle. - 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_GetGamepadSteamHandle, defined atSDL3/SDL_gamepad.h 1018:36
Since: 3.2.0
getGamepadConnectionState Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_JoystickConnectionState |
Get the connection state of a gamepad.
- Returns
- the connection state on success or
SDL_JOYSTICK_CONNECTION_INVALIDon failure; callgetErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadConnectionState. The safe flavor isgetGamepadConnectionStateSafe. - C declaration
SDL_GetGamepadConnectionState, defined atSDL3/SDL_gamepad.h 1032:57
Since: 3.2.0
getGamepadConnectionStateSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO SDL_JoystickConnectionState |
Get the connection state of a gamepad.
- Returns
- the connection state on success or
SDL_JOYSTICK_CONNECTION_INVALIDon failure; callgetErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadConnectionState. The unsafe flavor isgetGamepadConnectionState. - C declaration
SDL_GetGamepadConnectionState, defined atSDL3/SDL_gamepad.h 1032:57
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Ptr CInt |
|
| -> IO SDL_PowerState |
Get the battery state of a gamepad.
You should never take a battery status as absolute truth. Batteries (especially failing batteries) are delicate hardware, and the values reported here are best estimates based on what that hardware reports. It's not uncommon for older batteries to lose stored power much faster than it reports, or completely drain when reporting it has 20 percent left, etc.
- Returns
- the current battery state.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadPowerInfo. The safe flavor isgetGamepadPowerInfoSafe. - C declaration
SDL_GetGamepadPowerInfo, defined atSDL3/SDL_gamepad.h 1054:44
Since: 3.2.0
getGamepadPowerInfoSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Ptr CInt |
|
| -> IO SDL_PowerState |
Get the battery state of a gamepad.
You should never take a battery status as absolute truth. Batteries (especially failing batteries) are delicate hardware, and the values reported here are best estimates based on what that hardware reports. It's not uncommon for older batteries to lose stored power much faster than it reports, or completely drain when reporting it has 20 percent left, etc.
- Returns
- the current battery state.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadPowerInfo. The unsafe flavor isgetGamepadPowerInfo. - C declaration
SDL_GetGamepadPowerInfo, defined atSDL3/SDL_gamepad.h 1054:44
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Bool |
Check if a gamepad has been opened and is currently connected.
- Returns
- true if the gamepad has been opened and is currently connected, or false if not.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadConnected. The safe flavor isgamepadConnectedSafe. - 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_GamepadConnected, defined atSDL3/SDL_gamepad.h 1068:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Bool |
Check if a gamepad has been opened and is currently connected.
- Returns
- true if the gamepad has been opened and is currently connected, or false if not.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadConnected. The unsafe flavor isgamepadConnected. - 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_GamepadConnected, defined atSDL3/SDL_gamepad.h 1068:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (Ptr SDL_Joystick) |
Get the underlying joystick from a gamepad.
This function will give you a SDL_Joystick object, which allows you to use the SDL_Joystick functions with a SDL_Gamepad object. This would be useful for getting a joystick's position at any given time, even if it hasn't moved (moving it would produce an event, which would have the axis' value).
The pointer returned is owned by the SDL_Gamepad. You should not call closeJoystick on it, for example, since doing so will likely cause SDL to crash.
- Returns
- an SDL_Joystick object, or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadJoystick. The safe flavor isgetGamepadJoystickSafe. - C declaration
SDL_GetGamepadJoystick, defined atSDL3/SDL_gamepad.h 1090:44
Since: 3.2.0
getGamepadJoystickSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO (Ptr SDL_Joystick) |
Get the underlying joystick from a gamepad.
This function will give you a SDL_Joystick object, which allows you to use the SDL_Joystick functions with a SDL_Gamepad object. This would be useful for getting a joystick's position at any given time, even if it hasn't moved (moving it would produce an event, which would have the axis' value).
The pointer returned is owned by the SDL_Gamepad. You should not call closeJoystick on it, for example, since doing so will likely cause SDL to crash.
- Returns
- an SDL_Joystick object, or NULL on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadJoystick. The unsafe flavor isgetGamepadJoystick. - C declaration
SDL_GetGamepadJoystick, defined atSDL3/SDL_gamepad.h 1090:44
Since: 3.2.0
setGamepadEventsEnabled Source #
Set the state of gamepad event processing.
If gamepad events are disabled, you must call yourself and check the state of the gamepad when you want gamepad information.updateGamepads
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadEventsEnabled,updateGamepads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetGamepadEventsEnabled. The safe flavor issetGamepadEventsEnabledSafe. - 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_SetGamepadEventsEnabled, defined atSDL3/SDL_gamepad.h 1107:34
Since: 3.2.0
setGamepadEventsEnabledSafe Source #
Set the state of gamepad event processing.
If gamepad events are disabled, you must call yourself and check the state of the gamepad when you want gamepad information.updateGamepads
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadEventsEnabled,updateGamepads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetGamepadEventsEnabled. The unsafe flavor issetGamepadEventsEnabled. - 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_SetGamepadEventsEnabled, defined atSDL3/SDL_gamepad.h 1107:34
Since: 3.2.0
gamepadEventsEnabled :: IO Bool Source #
Query the state of gamepad event processing.
If gamepad events are disabled, you must call yourself and check the state of the gamepad when you want gamepad information.updateGamepads
- Returns
- true if gamepad events are being processed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadEventsEnabled
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadEventsEnabled. The safe flavor isgamepadEventsEnabledSafe. - 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_GamepadEventsEnabled, defined atSDL3/SDL_gamepad.h 1123:34
Since: 3.2.0
gamepadEventsEnabledSafe :: IO Bool Source #
Query the state of gamepad event processing.
If gamepad events are disabled, you must call yourself and check the state of the gamepad when you want gamepad information.updateGamepads
- Returns
- true if gamepad events are being processed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadEventsEnabled
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadEventsEnabled. The unsafe flavor isgamepadEventsEnabled. - 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_GamepadEventsEnabled, defined atSDL3/SDL_gamepad.h 1123:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Ptr CInt |
|
| -> IO (Ptr (Ptr SDL_GamepadBinding)) |
Get the SDL joystick layer bindings for a gamepad.
- Returns
- a NULL terminated array of pointers to bindings or NULL on failure; call
getErrorfor more information. This is a single allocation that should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadBindings. The safe flavor isgetGamepadBindingsSafe. - C declaration
SDL_GetGamepadBindings, defined atSDL3/SDL_gamepad.h 1139:51
Since: 3.2.0
getGamepadBindingsSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Ptr CInt |
|
| -> IO (Ptr (Ptr SDL_GamepadBinding)) |
Get the SDL joystick layer bindings for a gamepad.
- Returns
- a NULL terminated array of pointers to bindings or NULL on failure; call
getErrorfor more information. This is a single allocation that should be freed withfreewhen it is no longer needed. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadBindings. The unsafe flavor isgetGamepadBindings. - C declaration
SDL_GetGamepadBindings, defined atSDL3/SDL_gamepad.h 1139:51
Since: 3.2.0
updateGamepads :: IO () Source #
Manually pump gamepad updates if not using the loop.
This function is called automatically by the event loop if events are enabled. Under such circumstances, it will not be necessary to call this function.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_UpdateGamepads. The safe flavor isupdateGamepadsSafe: routes through joystick update; virtual-device callbacks run synchronously. - C declaration
SDL_UpdateGamepads, defined atSDL3/SDL_gamepad.h 1152:34
Since: 3.2.0
updateGamepadsSafe :: IO () Source #
Manually pump gamepad updates if not using the loop.
This function is called automatically by the event loop if events are enabled. Under such circumstances, it will not be necessary to call this function.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_UpdateGamepads. The unsafe flavor isupdateGamepads: routes through joystick update; virtual-device callbacks run synchronously. - C declaration
SDL_UpdateGamepads, defined atSDL3/SDL_gamepad.h 1152:34
Since: 3.2.0
getGamepadTypeFromString Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadType |
Convert a string into SDL_GamepadType enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
- Returns
- the
SDL_GamepadTypeenum corresponding to the input string, orSDL_GAMEPAD_TYPE_UNKNOWNif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForType
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadTypeFromString. The safe flavor isgetGamepadTypeFromStringSafe. - C declaration
SDL_GetGamepadTypeFromString, defined atSDL3/SDL_gamepad.h 1172:45
Since: 3.2.0
getGamepadTypeFromStringSafe Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadType |
Convert a string into SDL_GamepadType enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
- Returns
- the
SDL_GamepadTypeenum corresponding to the input string, orSDL_GAMEPAD_TYPE_UNKNOWNif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForType
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadTypeFromString. The unsafe flavor isgetGamepadTypeFromString. - C declaration
SDL_GetGamepadTypeFromString, defined atSDL3/SDL_gamepad.h 1172:45
Since: 3.2.0
getGamepadStringForType Source #
Arguments
| :: SDL_GamepadType |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadType enum to a string.
- Returns
- a string for the given type, or NULL if an invalid type is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeFromString
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadStringForType. The safe flavor isgetGamepadStringForTypeSafe. - C declaration
SDL_GetGamepadStringForType, defined atSDL3/SDL_gamepad.h 1188:42
Since: 3.2.0
getGamepadStringForTypeSafe Source #
Arguments
| :: SDL_GamepadType |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadType enum to a string.
- Returns
- a string for the given type, or NULL if an invalid type is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTypeFromString
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadStringForType. The unsafe flavor isgetGamepadStringForType. - C declaration
SDL_GetGamepadStringForType, defined atSDL3/SDL_gamepad.h 1188:42
Since: 3.2.0
getGamepadAxisFromString Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadAxis |
Convert a string into SDL_GamepadAxis enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
Note specially that "righttrigger" and "lefttrigger" map to SDL_GAMEPAD_AXIS_RIGHT_TRIGGER and SDL_GAMEPAD_AXIS_LEFT_TRIGGER, respectively.
- Returns
- the
SDL_GamepadAxisenum corresponding to the input string, orSDL_GAMEPAD_AXIS_INVALIDif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForAxis
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadAxisFromString. The safe flavor isgetGamepadAxisFromStringSafe. - C declaration
SDL_GetGamepadAxisFromString, defined atSDL3/SDL_gamepad.h 1212:45
Since: 3.2.0
getGamepadAxisFromStringSafe Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadAxis |
Convert a string into SDL_GamepadAxis enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
Note specially that "righttrigger" and "lefttrigger" map to SDL_GAMEPAD_AXIS_RIGHT_TRIGGER and SDL_GAMEPAD_AXIS_LEFT_TRIGGER, respectively.
- Returns
- the
SDL_GamepadAxisenum corresponding to the input string, orSDL_GAMEPAD_AXIS_INVALIDif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForAxis
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadAxisFromString. The unsafe flavor isgetGamepadAxisFromString. - C declaration
SDL_GetGamepadAxisFromString, defined atSDL3/SDL_gamepad.h 1212:45
Since: 3.2.0
getGamepadStringForAxis Source #
Arguments
| :: SDL_GamepadAxis |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadAxis enum to a string.
- Returns
- a string for the given axis, or NULL if an invalid axis is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAxisFromString
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadStringForAxis. The safe flavor isgetGamepadStringForAxisSafe. - C declaration
SDL_GetGamepadStringForAxis, defined atSDL3/SDL_gamepad.h 1228:42
Since: 3.2.0
getGamepadStringForAxisSafe Source #
Arguments
| :: SDL_GamepadAxis |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadAxis enum to a string.
- Returns
- a string for the given axis, or NULL if an invalid axis is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAxisFromString
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadStringForAxis. The unsafe flavor isgetGamepadStringForAxis. - C declaration
SDL_GetGamepadStringForAxis, defined atSDL3/SDL_gamepad.h 1228:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO Bool |
Query whether a gamepad has a given axis.
This merely reports whether the gamepad's mapping defined this axis, as that is all the information SDL has about the physical device.
- Returns
- true if the gamepad has this axis, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasButton,getGamepadAxis
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadHasAxis. The safe flavor isgamepadHasAxisSafe. - 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_GamepadHasAxis, defined atSDL3/SDL_gamepad.h 1247:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO Bool |
Query whether a gamepad has a given axis.
This merely reports whether the gamepad's mapping defined this axis, as that is all the information SDL has about the physical device.
- Returns
- true if the gamepad has this axis, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasButton,getGamepadAxis
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadHasAxis. The unsafe flavor isgamepadHasAxis. - 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_GamepadHasAxis, defined atSDL3/SDL_gamepad.h 1247:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO Int16 |
Get the current state of an axis control on a gamepad.
The axis indices start at index 0.
For thumbsticks, the state is a value ranging from -32768 (up/left) to 32767 (down/right).
Triggers range from 0 when released to 32767 when fully pressed, and never return a negative value. Note that this differs from the value reported by the lower-level getJoystickAxis, which normally uses the full range.
Note that for invalid gamepads or axes, this will return 0. Zero is also a valid value in normal operation; usually it means a centered axis.
- Returns
- axis state.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasAxis,getGamepadButton
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadAxis. The safe flavor isgetGamepadAxisSafe. - 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_GetGamepadAxis, defined atSDL3/SDL_gamepad.h 1275:36
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO Int16 |
Get the current state of an axis control on a gamepad.
The axis indices start at index 0.
For thumbsticks, the state is a value ranging from -32768 (up/left) to 32767 (down/right).
Triggers range from 0 when released to 32767 when fully pressed, and never return a negative value. Note that this differs from the value reported by the lower-level getJoystickAxis, which normally uses the full range.
Note that for invalid gamepads or axes, this will return 0. Zero is also a valid value in normal operation; usually it means a centered axis.
- Returns
- axis state.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasAxis,getGamepadButton
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadAxis. The unsafe flavor isgetGamepadAxis. - 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_GetGamepadAxis, defined atSDL3/SDL_gamepad.h 1275:36
Since: 3.2.0
getGamepadButtonFromString Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadButton |
Convert a string into an SDL_GamepadButton enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
- Returns
- the
SDL_GamepadButtonenum corresponding to the input string, orSDL_GAMEPAD_BUTTON_INVALIDif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForButton
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadButtonFromString. The safe flavor isgetGamepadButtonFromStringSafe. - C declaration
SDL_GetGamepadButtonFromString, defined atSDL3/SDL_gamepad.h 1295:47
Since: 3.2.0
getGamepadButtonFromStringSafe Source #
Arguments
| :: PtrConst CChar |
|
| -> IO SDL_GamepadButton |
Convert a string into an SDL_GamepadButton enum.
This function is called internally to translate SDL_Gamepad mapping strings for the underlying joystick device into the consistent SDL_Gamepad mapping. You do not normally need to call this function unless you are parsing SDL_Gamepad mappings in your own code.
- Returns
- the
SDL_GamepadButtonenum corresponding to the input string, orSDL_GAMEPAD_BUTTON_INVALIDif no match was found. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadStringForButton
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadButtonFromString. The unsafe flavor isgetGamepadButtonFromString. - C declaration
SDL_GetGamepadButtonFromString, defined atSDL3/SDL_gamepad.h 1295:47
Since: 3.2.0
getGamepadStringForButton Source #
Arguments
| :: SDL_GamepadButton |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadButton enum to a string.
- Returns
- a string for the given button, or NULL if an invalid button is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonFromString
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadStringForButton. The safe flavor isgetGamepadStringForButtonSafe. - C declaration
SDL_GetGamepadStringForButton, defined atSDL3/SDL_gamepad.h 1311:42
Since: 3.2.0
getGamepadStringForButtonSafe Source #
Arguments
| :: SDL_GamepadButton |
|
| -> IO (PtrConst CChar) |
Convert from an SDL_GamepadButton enum to a string.
- Returns
- a string for the given button, or NULL if an invalid button is specified. The string returned is of the format used by
SDL_Gamepadmapping strings. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonFromString
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadStringForButton. The unsafe flavor isgetGamepadStringForButton. - C declaration
SDL_GetGamepadStringForButton, defined atSDL3/SDL_gamepad.h 1311:42
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO Bool |
Query whether a gamepad has a given button.
This merely reports whether the gamepad's mapping defined this button, as that is all the information SDL has about the physical device.
- Returns
- true if the gamepad has this button, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasAxis
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadHasButton. The safe flavor isgamepadHasButtonSafe. - 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_GamepadHasButton, defined atSDL3/SDL_gamepad.h 1329:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO Bool |
Query whether a gamepad has a given button.
This merely reports whether the gamepad's mapping defined this button, as that is all the information SDL has about the physical device.
- Returns
- true if the gamepad has this button, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasAxis
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadHasButton. The unsafe flavor isgamepadHasButton. - 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_GamepadHasButton, defined atSDL3/SDL_gamepad.h 1329:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO Bool |
Get the current state of a button on a gamepad.
- Returns
- true if the button is pressed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasButton,getGamepadAxis
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadButton. The safe flavor isgetGamepadButtonSafe. - 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_GetGamepadButton, defined atSDL3/SDL_gamepad.h 1345:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO Bool |
Get the current state of a button on a gamepad.
- Returns
- true if the button is pressed, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasButton,getGamepadAxis
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadButton. The unsafe flavor isgetGamepadButton. - 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_GetGamepadButton, defined atSDL3/SDL_gamepad.h 1345:34
Since: 3.2.0
getGamepadButtonLabelForType Source #
Arguments
| :: SDL_GamepadType |
|
| -> SDL_GamepadButton |
|
| -> IO SDL_GamepadButtonLabel |
Get the label of a button on a gamepad.
- Returns
- the
SDL_GamepadButtonLabelenum corresponding to the button label. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonLabel
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadButtonLabelForType. The safe flavor isgetGamepadButtonLabelForTypeSafe. - C declaration
SDL_GetGamepadButtonLabelForType, defined atSDL3/SDL_gamepad.h 1360:52
Since: 3.2.0
getGamepadButtonLabelForTypeSafe Source #
Arguments
| :: SDL_GamepadType |
|
| -> SDL_GamepadButton |
|
| -> IO SDL_GamepadButtonLabel |
Get the label of a button on a gamepad.
- Returns
- the
SDL_GamepadButtonLabelenum corresponding to the button label. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonLabel
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadButtonLabelForType. The unsafe flavor isgetGamepadButtonLabelForType. - C declaration
SDL_GetGamepadButtonLabelForType, defined atSDL3/SDL_gamepad.h 1360:52
Since: 3.2.0
getGamepadButtonLabel Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO SDL_GamepadButtonLabel |
Get the label of a button on a gamepad.
- Returns
- the
SDL_GamepadButtonLabelenum corresponding to the button label. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonLabelForType
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadButtonLabel. The safe flavor isgetGamepadButtonLabelSafe. - C declaration
SDL_GetGamepadButtonLabel, defined atSDL3/SDL_gamepad.h 1375:52
Since: 3.2.0
getGamepadButtonLabelSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO SDL_GamepadButtonLabel |
Get the label of a button on a gamepad.
- Returns
- the
SDL_GamepadButtonLabelenum corresponding to the button label. - Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadButtonLabelForType
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadButtonLabel. The unsafe flavor isgetGamepadButtonLabel. - C declaration
SDL_GetGamepadButtonLabel, defined atSDL3/SDL_gamepad.h 1375:52
Since: 3.2.0
getNumGamepadTouchpads Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Int32 |
Get the number of touchpads on a gamepad.
- Returns
- number of touchpads.
- Thread safety
- It is safe to call this function from any thread.
- See also
getNumGamepadTouchpadFingers
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetNumGamepadTouchpads. The safe flavor isgetNumGamepadTouchpadsSafe. - 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_GetNumGamepadTouchpads, defined atSDL3/SDL_gamepad.h 1389:33
Since: 3.2.0
getNumGamepadTouchpadsSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO Int32 |
Get the number of touchpads on a gamepad.
- Returns
- number of touchpads.
- Thread safety
- It is safe to call this function from any thread.
- See also
getNumGamepadTouchpadFingers
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetNumGamepadTouchpads. The unsafe flavor isgetNumGamepadTouchpads. - 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_GetNumGamepadTouchpads, defined atSDL3/SDL_gamepad.h 1389:33
Since: 3.2.0
getNumGamepadTouchpadFingers Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> IO Int32 |
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
- Returns
- number of supported simultaneous fingers.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTouchpadFinger,getNumGamepadTouchpads
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetNumGamepadTouchpadFingers. The safe flavor isgetNumGamepadTouchpadFingersSafe. - 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_GetNumGamepadTouchpadFingers, defined atSDL3/SDL_gamepad.h 1406:33
Since: 3.2.0
getNumGamepadTouchpadFingersSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> IO Int32 |
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
- Returns
- number of supported simultaneous fingers.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadTouchpadFinger,getNumGamepadTouchpads
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetNumGamepadTouchpadFingers. The unsafe flavor isgetNumGamepadTouchpadFingers. - 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_GetNumGamepadTouchpadFingers, defined atSDL3/SDL_gamepad.h 1406:33
Since: 3.2.0
getGamepadTouchpadFinger Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> Int32 |
|
| -> Ptr CBool |
|
| -> Ptr CFloat |
|
| -> Ptr CFloat |
|
| -> Ptr CFloat |
|
| -> IO Bool |
Get the current state of a finger on a touchpad on a gamepad.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getNumGamepadTouchpadFingers
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadTouchpadFinger. The safe flavor isgetGamepadTouchpadFingerSafe. - 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_GetGamepadTouchpadFinger, defined atSDL3/SDL_gamepad.h 1430:34
Since: 3.2.0
getGamepadTouchpadFingerSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Int32 |
|
| -> Int32 |
|
| -> Ptr CBool |
|
| -> Ptr CFloat |
|
| -> Ptr CFloat |
|
| -> Ptr CFloat |
|
| -> IO Bool |
Get the current state of a finger on a touchpad on a gamepad.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
getNumGamepadTouchpadFingers
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadTouchpadFinger. The unsafe flavor isgetGamepadTouchpadFinger. - 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_GetGamepadTouchpadFinger, defined atSDL3/SDL_gamepad.h 1430:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Bool |
Return whether a gamepad has a particular sensor.
- Returns
- true if the sensor exists, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadSensorData,getGamepadSensorDataRate,setGamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadHasSensor. The safe flavor isgamepadHasSensorSafe. - 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_GamepadHasSensor, defined atSDL3/SDL_gamepad.h 1447:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Bool |
Return whether a gamepad has a particular sensor.
- Returns
- true if the sensor exists, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadSensorData,getGamepadSensorDataRate,setGamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadHasSensor. The unsafe flavor isgamepadHasSensor. - 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_GamepadHasSensor, defined atSDL3/SDL_gamepad.h 1447:34
Since: 3.2.0
setGamepadSensorEnabled Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> Bool |
|
| -> IO Bool |
Set whether data reporting for a gamepad sensor is enabled.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasSensor,gamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetGamepadSensorEnabled. The safe flavor issetGamepadSensorEnabledSafe. - 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_SetGamepadSensorEnabled, defined atSDL3/SDL_gamepad.h 1465:34
Since: 3.2.0
setGamepadSensorEnabledSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> Bool |
|
| -> IO Bool |
Set whether data reporting for a gamepad sensor is enabled.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
gamepadHasSensor,gamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetGamepadSensorEnabled. The unsafe flavor issetGamepadSensorEnabled. - 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_SetGamepadSensorEnabled, defined atSDL3/SDL_gamepad.h 1465:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Bool |
Query whether sensor data reporting is enabled for a gamepad.
- Returns
- true if the sensor is enabled, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GamepadSensorEnabled. The safe flavor isgamepadSensorEnabledSafe. - 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_GamepadSensorEnabled, defined atSDL3/SDL_gamepad.h 1480:34
Since: 3.2.0
gamepadSensorEnabledSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Bool |
Query whether sensor data reporting is enabled for a gamepad.
- Returns
- true if the sensor is enabled, false otherwise.
- Thread safety
- It is safe to call this function from any thread.
- See also
setGamepadSensorEnabled
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GamepadSensorEnabled. The unsafe flavor isgamepadSensorEnabled. - 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_GamepadSensorEnabled, defined atSDL3/SDL_gamepad.h 1480:34
Since: 3.2.0
getGamepadSensorDataRate Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Float |
Get the data rate (number of events per second) of a gamepad sensor.
- Returns
- the data rate, or 0.0f if the data rate is not available.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadSensorDataRate. The safe flavor isgetGamepadSensorDataRateSafe. - 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_GetGamepadSensorDataRate, defined atSDL3/SDL_gamepad.h 1493:35
Since: 3.2.0
getGamepadSensorDataRateSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> IO Float |
Get the data rate (number of events per second) of a gamepad sensor.
- Returns
- the data rate, or 0.0f if the data rate is not available.
- Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadSensorDataRate. The unsafe flavor isgetGamepadSensorDataRate. - 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_GetGamepadSensorDataRate, defined atSDL3/SDL_gamepad.h 1493:35
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> Ptr CFloat |
|
| -> Int32 |
|
| -> IO Bool |
Get the current state of a gamepad sensor.
The number of values and interpretation of the data is sensor dependent. See the remarks in SDL_SensorType for details for each type of sensor.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadSensorData. The safe flavor isgetGamepadSensorDataSafe. - 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_GetGamepadSensorData, defined atSDL3/SDL_gamepad.h 1512:34
Since: 3.2.0
getGamepadSensorDataSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_SensorType |
|
| -> Ptr CFloat |
|
| -> Int32 |
|
| -> IO Bool |
Get the current state of a gamepad sensor.
The number of values and interpretation of the data is sensor dependent. See the remarks in SDL_SensorType for details for each type of sensor.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadSensorData. The unsafe flavor isgetGamepadSensorData. - 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_GetGamepadSensorData, defined atSDL3/SDL_gamepad.h 1512:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word16 |
|
| -> Word16 |
|
| -> Word32 |
|
| -> IO Bool |
Start a rumble effect on a gamepad.
Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
This function requires you to process SDL events or call updateJoysticks to update rumble state.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_RumbleGamepad. The safe flavor isrumbleGamepadSafe. - 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_RumbleGamepad, defined atSDL3/SDL_gamepad.h 1536:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word16 |
|
| -> Word16 |
|
| -> Word32 |
|
| -> IO Bool |
Start a rumble effect on a gamepad.
Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
This function requires you to process SDL events or call updateJoysticks to update rumble state.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_RumbleGamepad. The unsafe flavor isrumbleGamepad. - 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_RumbleGamepad, defined atSDL3/SDL_gamepad.h 1536:34
Since: 3.2.0
rumbleGamepadTriggers Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word16 |
|
| -> Word16 |
|
| -> Word32 |
|
| -> IO Bool |
Start a rumble effect in the gamepad's triggers.
Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
Note that this is rumbling of the triggers and not the gamepad as a whole. This is currently only supported on Xbox One gamepads. If you want the (more common) whole-gamepad rumble, use instead.rumbleGamepad
This function requires you to process SDL events or call updateJoysticks to update rumble state.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
rumbleGamepad
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_RumbleGamepadTriggers. The safe flavor isrumbleGamepadTriggersSafe. - 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_RumbleGamepadTriggers, defined atSDL3/SDL_gamepad.h 1566:34
Since: 3.2.0
rumbleGamepadTriggersSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word16 |
|
| -> Word16 |
|
| -> Word32 |
|
| -> IO Bool |
Start a rumble effect in the gamepad's triggers.
Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
Note that this is rumbling of the triggers and not the gamepad as a whole. This is currently only supported on Xbox One gamepads. If you want the (more common) whole-gamepad rumble, use instead.rumbleGamepad
This function requires you to process SDL events or call updateJoysticks to update rumble state.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
- See also
rumbleGamepad
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_RumbleGamepadTriggers. The unsafe flavor isrumbleGamepadTriggers. - 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_RumbleGamepadTriggers, defined atSDL3/SDL_gamepad.h 1566:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word8 |
|
| -> Word8 |
|
| -> Word8 |
|
| -> IO Bool |
Update a gamepad's LED color.
An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.
For gamepads with a single color LED, the maximum of the RGB values will be used as the LED brightness.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SetGamepadLED. The safe flavor issetGamepadLEDSafe. - 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_SetGamepadLED, defined atSDL3/SDL_gamepad.h 1588:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> Word8 |
|
| -> Word8 |
|
| -> Word8 |
|
| -> IO Bool |
Update a gamepad's LED color.
An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.
For gamepads with a single color LED, the maximum of the RGB values will be used as the LED brightness.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SetGamepadLED. The unsafe flavor issetGamepadLED. - 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_SetGamepadLED, defined atSDL3/SDL_gamepad.h 1588:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> PtrConst Void |
|
| -> Int32 |
|
| -> IO Bool |
Send a gamepad specific effect packet.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_SendGamepadEffect. The safe flavor issendGamepadEffectSafe. - 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_SendGamepadEffect, defined atSDL3/SDL_gamepad.h 1603:34
Since: 3.2.0
sendGamepadEffectSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> PtrConst Void |
|
| -> Int32 |
|
| -> IO Bool |
Send a gamepad specific effect packet.
- Returns
- true on success or false on failure; call
getErrorfor more information. - Thread safety
- It is safe to call this function from any thread.
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_SendGamepadEffect. The unsafe flavor issendGamepadEffect. - 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_SendGamepadEffect, defined atSDL3/SDL_gamepad.h 1603:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO () |
Close a gamepad previously opened with .openGamepad
- Thread safety
- It is safe to call this function from any thread.
- See also
openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_CloseGamepad. The safe flavor iscloseGamepadSafe. - C declaration
SDL_CloseGamepad, defined atSDL3/SDL_gamepad.h 1617:34
Since: 3.2.0
Arguments
| :: Ptr SDL_Gamepad |
|
| -> IO () |
Close a gamepad previously opened with .openGamepad
- Thread safety
- It is safe to call this function from any thread.
- See also
openGamepad
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_CloseGamepad. The unsafe flavor iscloseGamepad. - C declaration
SDL_CloseGamepad, defined atSDL3/SDL_gamepad.h 1617:34
Since: 3.2.0
getGamepadAppleSFSymbolsNameForButton Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO (PtrConst CChar) |
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
- Returns
- the sfSymbolsName or NULL if the name can't be found.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAppleSFSymbolsNameForAxis
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadAppleSFSymbolsNameForButton. The safe flavor isgetGamepadAppleSFSymbolsNameForButtonSafe. - C declaration
SDL_GetGamepadAppleSFSymbolsNameForButton, defined atSDL3/SDL_gamepad.h 1633:42
Since: 3.2.0
getGamepadAppleSFSymbolsNameForButtonSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadButton |
|
| -> IO (PtrConst CChar) |
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
- Returns
- the sfSymbolsName or NULL if the name can't be found.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAppleSFSymbolsNameForAxis
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadAppleSFSymbolsNameForButton. The unsafe flavor isgetGamepadAppleSFSymbolsNameForButton. - C declaration
SDL_GetGamepadAppleSFSymbolsNameForButton, defined atSDL3/SDL_gamepad.h 1633:42
Since: 3.2.0
getGamepadAppleSFSymbolsNameForAxis Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO (PtrConst CChar) |
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
- Returns
- the sfSymbolsName or NULL if the name can't be found.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAppleSFSymbolsNameForButton
sdl3-bindgen-sys notes
- FFI safety
- Unsafe foreign import of
SDL_GetGamepadAppleSFSymbolsNameForAxis. The safe flavor isgetGamepadAppleSFSymbolsNameForAxisSafe. - C declaration
SDL_GetGamepadAppleSFSymbolsNameForAxis, defined atSDL3/SDL_gamepad.h 1648:42
Since: 3.2.0
getGamepadAppleSFSymbolsNameForAxisSafe Source #
Arguments
| :: Ptr SDL_Gamepad |
|
| -> SDL_GamepadAxis |
|
| -> IO (PtrConst CChar) |
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
- Returns
- the sfSymbolsName or NULL if the name can't be found.
- Thread safety
- It is safe to call this function from any thread.
- See also
getGamepadAppleSFSymbolsNameForButton
sdl3-bindgen-sys notes
- FFI safety
- Safe foreign import of
SDL_GetGamepadAppleSFSymbolsNameForAxis. The unsafe flavor isgetGamepadAppleSFSymbolsNameForAxis. - C declaration
SDL_GetGamepadAppleSFSymbolsNameForAxis, defined atSDL3/SDL_gamepad.h 1648:42
Since: 3.2.0