sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Joystick

Description

SDL joystick support.

This is the lower-level joystick handling. If you want the simpler option, where what each button does is well-defined, you should use the gamepad API instead.

The term "instance_id" is the current instantiation of a joystick device in the system. If the joystick is removed and then re-inserted then it will get a new instance_id. instance_id's are monotonically increasing identifiers of a joystick plugged in.

The term "player_index" is the number assigned to a player on a specific controller. For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.

SDL_GUID is used as a stable 128-bit identifier for a joystick device that does not change over time. It identifies class of the device (a X360 wired controller for example). This identifier is platform dependent.

In order to use these functions, init must have been called with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system for joysticks, and load appropriate drivers.

If you would like to receive joystick updates while the application is in the background, you should set the following hint before calling init: SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS

SDL can provide virtual joysticks as well: the app defines an imaginary controller with attachVirtualJoystick, and then can provide inputs for it via setJoystickVirtualAxis, setJoystickVirtualButton, etc. As this data is supplied, it will look like a normal joystick to SDL, just not backed by a hardware driver. This has been used to make unusual devices, like VR headset controllers, look like normal joysticks, or provide recording/playback of game inputs, etc. The joystick structure used to identify an SDL joystick.

This is opaque data.

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.Joystick.Unsafe); functions curated unsafe-only export only the unsuffixed one. Each alias's documentation records its flavor and rationale.

Full conventions: SDL3.Sys.

Since: 3.2.0

Synopsis

Documentation

Function aliases

lockJoysticks :: IO () Source #

Locking for atomic access to the joystick API.

The SDL joystick functions are thread-safe, however you can lock the joysticks while processing to guarantee that the joystick list won't change and joystick and gamepad events will not be delivered.

Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_LockJoysticks. The safe flavor is lockJoysticksSafe .
C declaration
SDL_LockJoysticks, defined at SDL3/SDL_joystick.h 189:34

Since: 3.2.0

lockJoysticksSafe :: IO () Source #

Locking for atomic access to the joystick API.

The SDL joystick functions are thread-safe, however you can lock the joysticks while processing to guarantee that the joystick list won't change and joystick and gamepad events will not be delivered.

Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_LockJoysticks. The unsafe flavor is lockJoysticks .
C declaration
SDL_LockJoysticks, defined at SDL3/SDL_joystick.h 189:34

Since: 3.2.0

unlockJoysticks :: IO () Source #

Unlocking for atomic access to the joystick API.

Thread safety
This should be called from the same thread that called lockJoysticks.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_UnlockJoysticks. The safe flavor is unlockJoysticksSafe .
C declaration
SDL_UnlockJoysticks, defined at SDL3/SDL_joystick.h 199:34

Since: 3.2.0

unlockJoysticksSafe :: IO () Source #

Unlocking for atomic access to the joystick API.

Thread safety
This should be called from the same thread that called lockJoysticks.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_UnlockJoysticks. The unsafe flavor is unlockJoysticks .
C declaration
SDL_UnlockJoysticks, defined at SDL3/SDL_joystick.h 199:34

Since: 3.2.0

hasJoystick :: IO Bool Source #

Return whether a joystick is currently connected.

Returns
true if a joystick is connected, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_HasJoystick. The safe flavor is hasJoystickSafe .
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_HasJoystick, defined at SDL3/SDL_joystick.h 212:34

Since: 3.2.0

hasJoystickSafe :: IO Bool Source #

Return whether a joystick is currently connected.

Returns
true if a joystick is connected, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_HasJoystick. The unsafe flavor is hasJoystick .
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_HasJoystick, defined at SDL3/SDL_joystick.h 212:34

Since: 3.2.0

getJoysticks Source #

Arguments

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

Get a list of currently connected joysticks.

Returns
a 0 terminated array of joystick instance IDs or NULL on failure; call getError for more information. This should be freed with free when it is no longer needed.
Thread safety
It is safe to call this function from any thread.
See also
hasJoystick, openJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoysticks. The safe flavor is getJoysticksSafe .
C declaration
SDL_GetJoysticks, defined at SDL3/SDL_joystick.h 230:46

Since: 3.2.0

getJoysticksSafe Source #

Arguments

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

Get a list of currently connected joysticks.

Returns
a 0 terminated array of joystick instance IDs or NULL on failure; call getError for more information. This should be freed with free when it is no longer needed.
Thread safety
It is safe to call this function from any thread.
See also
hasJoystick, openJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoysticks. The unsafe flavor is getJoysticks .
C declaration
SDL_GetJoysticks, defined at SDL3/SDL_joystick.h 230:46

Since: 3.2.0

getJoystickNameForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (PtrConst CChar) 

Get the implementation dependent name of a joystick.

This can be called before any joysticks are opened.

Returns
the name of the selected joystick. If no name can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickName, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickNameForID. The safe flavor is getJoystickNameForIDSafe .
C declaration
SDL_GetJoystickNameForID, defined at SDL3/SDL_joystick.h 248:42

Since: 3.2.0

getJoystickNameForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (PtrConst CChar) 

Get the implementation dependent name of a joystick.

This can be called before any joysticks are opened.

Returns
the name of the selected joystick. If no name can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickName, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickNameForID. The unsafe flavor is getJoystickNameForID .
C declaration
SDL_GetJoystickNameForID, defined at SDL3/SDL_joystick.h 248:42

Since: 3.2.0

getJoystickPathForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (PtrConst CChar) 

Get the implementation dependent path of a joystick.

This can be called before any joysticks are opened.

Returns
the path of the selected joystick. If no path can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPath, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickPathForID. The safe flavor is getJoystickPathForIDSafe .
C declaration
SDL_GetJoystickPathForID, defined at SDL3/SDL_joystick.h 266:42

Since: 3.2.0

getJoystickPathForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (PtrConst CChar) 

Get the implementation dependent path of a joystick.

This can be called before any joysticks are opened.

Returns
the path of the selected joystick. If no path can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPath, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickPathForID. The unsafe flavor is getJoystickPathForID .
C declaration
SDL_GetJoystickPathForID, defined at SDL3/SDL_joystick.h 266:42

Since: 3.2.0

getJoystickPlayerIndexForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Int32 

Get the player index of a joystick.

This can be called before any joysticks are opened.

Returns
the player index of a joystick, or -1 if it's not available.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickPlayerIndexForID. The safe flavor is getJoystickPlayerIndexForIDSafe .
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_GetJoystickPlayerIndexForID, defined at SDL3/SDL_joystick.h 283:33

Since: 3.2.0

getJoystickPlayerIndexForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Int32 

Get the player index of a joystick.

This can be called before any joysticks are opened.

Returns
the player index of a joystick, or -1 if it's not available.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickPlayerIndexForID. The unsafe flavor is getJoystickPlayerIndexForID .
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_GetJoystickPlayerIndexForID, defined at SDL3/SDL_joystick.h 283:33

Since: 3.2.0

getJoystickGUIDForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO SDL_GUID 

Get the implementation-dependent GUID of a joystick.

This can be called before any joysticks are opened.

Returns
the GUID of the selected joystick. If called with an invalid instance_id, this function returns a zero GUID.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUID, guidToString

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickGUIDForID. The safe flavor is getJoystickGUIDForIDSafe .
C declaration
SDL_GetJoystickGUIDForID, defined at SDL3/SDL_joystick.h 301:38

Since: 3.2.0

getJoystickGUIDForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO SDL_GUID 

Get the implementation-dependent GUID of a joystick.

This can be called before any joysticks are opened.

Returns
the GUID of the selected joystick. If called with an invalid instance_id, this function returns a zero GUID.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUID, guidToString

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickGUIDForID. The unsafe flavor is getJoystickGUIDForID .
C declaration
SDL_GetJoystickGUIDForID, defined at SDL3/SDL_joystick.h 301:38

Since: 3.2.0

getJoystickVendorForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the USB vendor ID of a joystick, if available.

This can be called before any joysticks are opened. If the vendor ID isn't available this function returns 0.

Returns
the USB vendor ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickVendor, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickVendorForID. The safe flavor is getJoystickVendorForIDSafe .
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_GetJoystickVendorForID, defined at SDL3/SDL_joystick.h 320:36

Since: 3.2.0

getJoystickVendorForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the USB vendor ID of a joystick, if available.

This can be called before any joysticks are opened. If the vendor ID isn't available this function returns 0.

Returns
the USB vendor ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickVendor, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickVendorForID. The unsafe flavor is getJoystickVendorForID .
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_GetJoystickVendorForID, defined at SDL3/SDL_joystick.h 320:36

Since: 3.2.0

getJoystickProductForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the USB product ID of a joystick, if available.

This can be called before any joysticks are opened. If the product ID isn't available this function returns 0.

Returns
the USB product ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProduct, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickProductForID. The safe flavor is getJoystickProductForIDSafe .
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_GetJoystickProductForID, defined at SDL3/SDL_joystick.h 339:36

Since: 3.2.0

getJoystickProductForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the USB product ID of a joystick, if available.

This can be called before any joysticks are opened. If the product ID isn't available this function returns 0.

Returns
the USB product ID of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProduct, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickProductForID. The unsafe flavor is getJoystickProductForID .
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_GetJoystickProductForID, defined at SDL3/SDL_joystick.h 339:36

Since: 3.2.0

getJoystickProductVersionForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the product version of a joystick, if available.

This can be called before any joysticks are opened. If the product version isn't available this function returns 0.

Returns
the product version of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductVersion, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickProductVersionForID. The safe flavor is getJoystickProductVersionForIDSafe .
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_GetJoystickProductVersionForID, defined at SDL3/SDL_joystick.h 358:36

Since: 3.2.0

getJoystickProductVersionForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Word16 

Get the product version of a joystick, if available.

This can be called before any joysticks are opened. If the product version isn't available this function returns 0.

Returns
the product version of the selected joystick. If called with an invalid instance_id, this function returns 0.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductVersion, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickProductVersionForID. The unsafe flavor is getJoystickProductVersionForID .
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_GetJoystickProductVersionForID, defined at SDL3/SDL_joystick.h 358:36

Since: 3.2.0

getJoystickTypeForID Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO SDL_JoystickType 

Get the type of a joystick, if available.

This can be called before any joysticks are opened.

Returns
the SDL_JoystickType of the selected joystick. If called with an invalid instance_id, this function returns SDL_JOYSTICK_TYPE_UNKNOWN.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickType, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickTypeForID. The safe flavor is getJoystickTypeForIDSafe .
C declaration
SDL_GetJoystickTypeForID, defined at SDL3/SDL_joystick.h 377:46

Since: 3.2.0

getJoystickTypeForIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO SDL_JoystickType 

Get the type of a joystick, if available.

This can be called before any joysticks are opened.

Returns
the SDL_JoystickType of the selected joystick. If called with an invalid instance_id, this function returns SDL_JOYSTICK_TYPE_UNKNOWN.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickType, getJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickTypeForID. The unsafe flavor is getJoystickTypeForID .
C declaration
SDL_GetJoystickTypeForID, defined at SDL3/SDL_joystick.h 377:46

Since: 3.2.0

openJoystick Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (Ptr SDL_Joystick) 

Open a joystick for use.

The joystick subsystem must be initialized before a joystick can be opened for use.

Returns
a joystick identifier or NULL on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
closeJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_OpenJoystick. The safe flavor is openJoystickSafe .
C declaration
SDL_OpenJoystick, defined at SDL3/SDL_joystick.h 395:44

Since: 3.2.0

openJoystickSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO (Ptr SDL_Joystick) 

Open a joystick for use.

The joystick subsystem must be initialized before a joystick can be opened for use.

Returns
a joystick identifier or NULL on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
closeJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_OpenJoystick. The unsafe flavor is openJoystick .
C declaration
SDL_OpenJoystick, defined at SDL3/SDL_joystick.h 395:44

Since: 3.2.0

getJoystickFromID Source #

Arguments

:: SDL_JoystickID
instance_id
the instance ID to get the SDL_Joystick for.
-> IO (Ptr SDL_Joystick) 

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

Returns
an SDL_Joystick on success or NULL on failure or if it hasn't been opened yet; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickFromID. The safe flavor is getJoystickFromIDSafe .
C declaration
SDL_GetJoystickFromID, defined at SDL3/SDL_joystick.h 408:44

Since: 3.2.0

getJoystickFromIDSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the instance ID to get the SDL_Joystick for.
-> IO (Ptr SDL_Joystick) 

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

Returns
an SDL_Joystick on success or NULL on failure or if it hasn't been opened yet; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickFromID. The unsafe flavor is getJoystickFromID .
C declaration
SDL_GetJoystickFromID, defined at SDL3/SDL_joystick.h 408:44

Since: 3.2.0

getJoystickFromPlayerIndex Source #

Arguments

:: Int32
player_index
the player index to get the SDL_Joystick for.
-> IO (Ptr SDL_Joystick) 

Get the SDL_Joystick associated with a player index.

Returns
an SDL_Joystick on success or NULL on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex, setJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickFromPlayerIndex. The safe flavor is getJoystickFromPlayerIndexSafe .
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_GetJoystickFromPlayerIndex, defined at SDL3/SDL_joystick.h 424:44

Since: 3.2.0

getJoystickFromPlayerIndexSafe Source #

Arguments

:: Int32
player_index
the player index to get the SDL_Joystick for.
-> IO (Ptr SDL_Joystick) 

Get the SDL_Joystick associated with a player index.

Returns
an SDL_Joystick on success or NULL on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex, setJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickFromPlayerIndex. The unsafe flavor is getJoystickFromPlayerIndex .
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_GetJoystickFromPlayerIndex, defined at SDL3/SDL_joystick.h 424:44

Since: 3.2.0

attachVirtualJoystick Source #

Arguments

:: PtrConst SDL_VirtualJoystickDesc
desc
joystick description, initialized using SDL_INIT_INTERFACE().
-> IO SDL_JoystickID 

Attach a new virtual joystick.

Apps can create virtual joysticks, that exist without hardware directly backing them, and have program-supplied inputs. Once attached, a virtual joystick looks like any other joystick that SDL can access. These can be used to make other things look like joysticks, or provide pre-recorded input, etc.

Once attached, the app can send joystick inputs to the new virtual joystick using setJoystickVirtualAxis, etc.

When no longer needed, the virtual joystick can be removed by calling detachVirtualJoystick.

Returns
the joystick instance ID, or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
detachVirtualJoystick, setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_AttachVirtualJoystick. The safe flavor is attachVirtualJoystickSafe .
C declaration
SDL_AttachVirtualJoystick, defined at SDL3/SDL_joystick.h 539:44

Since: 3.2.0

attachVirtualJoystickSafe Source #

Arguments

:: PtrConst SDL_VirtualJoystickDesc
desc
joystick description, initialized using SDL_INIT_INTERFACE().
-> IO SDL_JoystickID 

Attach a new virtual joystick.

Apps can create virtual joysticks, that exist without hardware directly backing them, and have program-supplied inputs. Once attached, a virtual joystick looks like any other joystick that SDL can access. These can be used to make other things look like joysticks, or provide pre-recorded input, etc.

Once attached, the app can send joystick inputs to the new virtual joystick using setJoystickVirtualAxis, etc.

When no longer needed, the virtual joystick can be removed by calling detachVirtualJoystick.

Returns
the joystick instance ID, or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
detachVirtualJoystick, setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_AttachVirtualJoystick. The unsafe flavor is attachVirtualJoystick .
C declaration
SDL_AttachVirtualJoystick, defined at SDL3/SDL_joystick.h 539:44

Since: 3.2.0

detachVirtualJoystick Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID, previously returned from attachVirtualJoystick.
-> IO Bool 

Detach a virtual joystick.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
attachVirtualJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_DetachVirtualJoystick. The safe flavor is detachVirtualJoystickSafe : a virtual joystick's cleanup callback runs synchronously.
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_DetachVirtualJoystick, defined at SDL3/SDL_joystick.h 555:34

Since: 3.2.0

detachVirtualJoystickSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID, previously returned from attachVirtualJoystick.
-> IO Bool 

Detach a virtual joystick.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
attachVirtualJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_DetachVirtualJoystick. The unsafe flavor is detachVirtualJoystick : a virtual joystick's cleanup callback runs synchronously.
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_DetachVirtualJoystick, defined at SDL3/SDL_joystick.h 555:34

Since: 3.2.0

isJoystickVirtual Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Bool 

Query whether or not a joystick is virtual.

Returns
true if the joystick is virtual, false otherwise.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_IsJoystickVirtual. The safe flavor is isJoystickVirtualSafe .
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_IsJoystickVirtual, defined at SDL3/SDL_joystick.h 567:34

Since: 3.2.0

isJoystickVirtualSafe Source #

Arguments

:: SDL_JoystickID
instance_id
the joystick instance ID.
-> IO Bool 

Query whether or not a joystick is virtual.

Returns
true if the joystick is virtual, false otherwise.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_IsJoystickVirtual. The unsafe flavor is isJoystickVirtual .
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_IsJoystickVirtual, defined at SDL3/SDL_joystick.h 567:34

Since: 3.2.0

setJoystickVirtualAxis Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
axis
the index of the axis on the virtual joystick to update.
-> Int16
value
the new value for the specified axis.
-> IO Bool 

Set the state of an axis on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Note that when sending trigger axes, you should scale the value to the full range of Sint16. For example, a trigger at rest would have the value of sDL_JOYSTICK_AXIS_MIN.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickVirtualAxis. The safe flavor is setJoystickVirtualAxisSafe .
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_SetJoystickVirtualAxis, defined at SDL3/SDL_joystick.h 598:34

Since: 3.2.0

setJoystickVirtualAxisSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
axis
the index of the axis on the virtual joystick to update.
-> Int16
value
the new value for the specified axis.
-> IO Bool 

Set the state of an axis on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Note that when sending trigger axes, you should scale the value to the full range of Sint16. For example, a trigger at rest would have the value of sDL_JOYSTICK_AXIS_MIN.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickVirtualAxis. The unsafe flavor is setJoystickVirtualAxis .
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_SetJoystickVirtualAxis, defined at SDL3/SDL_joystick.h 598:34

Since: 3.2.0

setJoystickVirtualBall Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
ball
the index of the ball on the virtual joystick to update.
-> Int16
xrel
the relative motion on the X axis.
-> Int16
yrel
the relative motion on the Y axis.
-> IO Bool 

Generate ball motion on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickVirtualBall. The safe flavor is setJoystickVirtualBallSafe .
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_SetJoystickVirtualBall, defined at SDL3/SDL_joystick.h 626:34

Since: 3.2.0

setJoystickVirtualBallSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
ball
the index of the ball on the virtual joystick to update.
-> Int16
xrel
the relative motion on the X axis.
-> Int16
yrel
the relative motion on the Y axis.
-> IO Bool 

Generate ball motion on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickVirtualBall. The unsafe flavor is setJoystickVirtualBall .
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_SetJoystickVirtualBall, defined at SDL3/SDL_joystick.h 626:34

Since: 3.2.0

setJoystickVirtualButton Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
button
the index of the button on the virtual joystick to update.
-> Bool
down
true if the button is pressed, false otherwise.
-> IO Bool 

Set the state of a button on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickVirtualButton. The safe flavor is setJoystickVirtualButtonSafe .
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_SetJoystickVirtualButton, defined at SDL3/SDL_joystick.h 653:34

Since: 3.2.0

setJoystickVirtualButtonSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
button
the index of the button on the virtual joystick to update.
-> Bool
down
true if the button is pressed, false otherwise.
-> IO Bool 

Set the state of a button on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickVirtualButton. The unsafe flavor is setJoystickVirtualButton .
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_SetJoystickVirtualButton, defined at SDL3/SDL_joystick.h 653:34

Since: 3.2.0

setJoystickVirtualHat Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
hat
the index of the hat on the virtual joystick to update.
-> Word8
value
the new value for the specified hat.
-> IO Bool 

Set the state of a hat on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickVirtualHat. The safe flavor is setJoystickVirtualHatSafe .
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_SetJoystickVirtualHat, defined at SDL3/SDL_joystick.h 680:34

Since: 3.2.0

setJoystickVirtualHatSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
hat
the index of the hat on the virtual joystick to update.
-> Word8
value
the new value for the specified hat.
-> IO Bool 

Set the state of a hat on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualTouchpad, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickVirtualHat. The unsafe flavor is setJoystickVirtualHat .
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_SetJoystickVirtualHat, defined at SDL3/SDL_joystick.h 680:34

Since: 3.2.0

setJoystickVirtualTouchpad Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
touchpad
the index of the touchpad on the virtual joystick to update.
-> Int32
finger
the index of the finger on the touchpad to set.
-> Bool
down
true if the finger is pressed, false if the finger is released.
-> Float
x
the x coordinate of the finger on the touchpad, normalized 0 to 1, with the origin in the upper left.
-> Float
y
the y coordinate of the finger on the touchpad, normalized 0 to 1, with the origin in the upper left.
-> Float
pressure
the pressure of the finger.
-> IO Bool 

Set touchpad finger state on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickVirtualTouchpad. The safe flavor is setJoystickVirtualTouchpadSafe .
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_SetJoystickVirtualTouchpad, defined at SDL3/SDL_joystick.h 714:34

Since: 3.2.0

setJoystickVirtualTouchpadSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> Int32
touchpad
the index of the touchpad on the virtual joystick to update.
-> Int32
finger
the index of the finger on the touchpad to set.
-> Bool
down
true if the finger is pressed, false if the finger is released.
-> Float
x
the x coordinate of the finger on the touchpad, normalized 0 to 1, with the origin in the upper left.
-> Float
y
the y coordinate of the finger on the touchpad, normalized 0 to 1, with the origin in the upper left.
-> Float
pressure
the pressure of the finger.
-> IO Bool 

Set touchpad finger state on an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, SDL_SetJoystickVirtualSensorData

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickVirtualTouchpad. The unsafe flavor is setJoystickVirtualTouchpad .
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_SetJoystickVirtualTouchpad, defined at SDL3/SDL_joystick.h 714:34

Since: 3.2.0

sendJoystickVirtualSensorData Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> SDL_SensorType
type
the type of the sensor on the virtual joystick to update.
-> Word64
sensor_timestamp
a 64-bit timestamp in nanoseconds associated with the sensor reading.
-> PtrConst CFloat
data
the data associated with the sensor reading.
-> Int32
num_values
the number of values pointed to by data.
-> IO Bool 

Send a sensor update for an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SendJoystickVirtualSensorData. The safe flavor is sendJoystickVirtualSensorDataSafe .
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_SendJoystickVirtualSensorData, defined at SDL3/SDL_joystick.h 744:34

Since: 3.2.0

sendJoystickVirtualSensorDataSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the virtual joystick on which to set state.
-> SDL_SensorType
type
the type of the sensor on the virtual joystick to update.
-> Word64
sensor_timestamp
a 64-bit timestamp in nanoseconds associated with the sensor reading.
-> PtrConst CFloat
data
the data associated with the sensor reading.
-> Int32
num_values
the number of values pointed to by data.
-> IO Bool 

Send a sensor update for an opened virtual joystick.

Please note that values set here will not be applied until the next call to updateJoysticks, which can either be called directly, or can be called indirectly through various other SDL APIs, including, but not limited to the following: pollEvent, pumpEvents, waitEventTimeout, waitEvent.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickVirtualAxis, setJoystickVirtualButton, setJoystickVirtualBall, setJoystickVirtualHat, setJoystickVirtualTouchpad

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SendJoystickVirtualSensorData. The unsafe flavor is sendJoystickVirtualSensorData .
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_SendJoystickVirtualSensorData, defined at SDL3/SDL_joystick.h 744:34

Since: 3.2.0

getJoystickProperties Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_PropertiesID 

Get the properties associated with a joystick.

The following read-only properties are provided by SDL:

Returns
a valid property ID on success or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickProperties. The safe flavor is getJoystickPropertiesSafe .
C declaration
SDL_GetJoystickProperties, defined at SDL3/SDL_joystick.h 770:46

Since: 3.2.0

getJoystickPropertiesSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_PropertiesID 

Get the properties associated with a joystick.

The following read-only properties are provided by SDL:

Returns
a valid property ID on success or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickProperties. The unsafe flavor is getJoystickProperties .
C declaration
SDL_GetJoystickProperties, defined at SDL3/SDL_joystick.h 770:46

Since: 3.2.0

getJoystickName Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the implementation dependent name of a joystick.

Returns
the name of the selected joystick. If no name can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickNameForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickName. The safe flavor is getJoystickNameSafe .
C declaration
SDL_GetJoystickName, defined at SDL3/SDL_joystick.h 791:42

Since: 3.2.0

getJoystickNameSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the implementation dependent name of a joystick.

Returns
the name of the selected joystick. If no name can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickNameForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickName. The unsafe flavor is getJoystickName .
C declaration
SDL_GetJoystickName, defined at SDL3/SDL_joystick.h 791:42

Since: 3.2.0

getJoystickPath Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the implementation dependent path of a joystick.

Returns
the path of the selected joystick. If no path can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPathForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickPath. The safe flavor is getJoystickPathSafe .
C declaration
SDL_GetJoystickPath, defined at SDL3/SDL_joystick.h 806:42

Since: 3.2.0

getJoystickPathSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the implementation dependent path of a joystick.

Returns
the path of the selected joystick. If no path can be found, this function returns NULL; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPathForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickPath. The unsafe flavor is getJoystickPath .
C declaration
SDL_GetJoystickPath, defined at SDL3/SDL_joystick.h 806:42

Since: 3.2.0

getJoystickPlayerIndex Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Int32 

Get the player index of an opened joystick.

For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.

Returns
the player index, or -1 if it's not available.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickPlayerIndex. The safe flavor is getJoystickPlayerIndexSafe .
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_GetJoystickPlayerIndex, defined at SDL3/SDL_joystick.h 823:33

Since: 3.2.0

getJoystickPlayerIndexSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Int32 

Get the player index of an opened joystick.

For XInput controllers this returns the XInput user index. Many joysticks will not be able to supply this information.

Returns
the player index, or -1 if it's not available.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickPlayerIndex. The unsafe flavor is getJoystickPlayerIndex .
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_GetJoystickPlayerIndex, defined at SDL3/SDL_joystick.h 823:33

Since: 3.2.0

setJoystickPlayerIndex Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> Int32
player_index
player index to assign to this joystick, or -1 to clear the player index and turn off player LEDs.
-> IO Bool 

Set the player index of an opened joystick.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickPlayerIndex. The safe flavor is setJoystickPlayerIndexSafe .
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_SetJoystickPlayerIndex, defined at SDL3/SDL_joystick.h 840:34

Since: 3.2.0

setJoystickPlayerIndexSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> Int32
player_index
player index to assign to this joystick, or -1 to clear the player index and turn off player LEDs.
-> IO Bool 

Set the player index of an opened joystick.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickPlayerIndex

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickPlayerIndex. The unsafe flavor is setJoystickPlayerIndex .
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_SetJoystickPlayerIndex, defined at SDL3/SDL_joystick.h 840:34

Since: 3.2.0

getJoystickGUID Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_GUID 

Get the implementation-dependent GUID for the joystick.

This function requires an open joystick.

Returns
the GUID of the given joystick. If called on an invalid index, this function returns a zero GUID; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUIDForID, guidToString

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickGUID. The safe flavor is getJoystickGUIDSafe .
C declaration
SDL_GetJoystickGUID, defined at SDL3/SDL_joystick.h 859:38

Since: 3.2.0

getJoystickGUIDSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_GUID 

Get the implementation-dependent GUID for the joystick.

This function requires an open joystick.

Returns
the GUID of the given joystick. If called on an invalid index, this function returns a zero GUID; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUIDForID, guidToString

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickGUID. The unsafe flavor is getJoystickGUID .
C declaration
SDL_GetJoystickGUID, defined at SDL3/SDL_joystick.h 859:38

Since: 3.2.0

getJoystickVendor Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the USB vendor ID of an opened joystick, if available.

If the vendor ID isn't available this function returns 0.

Returns
the USB vendor ID of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickVendorForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickVendor. The safe flavor is getJoystickVendorSafe .
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_GetJoystickVendor, defined at SDL3/SDL_joystick.h 875:36

Since: 3.2.0

getJoystickVendorSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the USB vendor ID of an opened joystick, if available.

If the vendor ID isn't available this function returns 0.

Returns
the USB vendor ID of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickVendorForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickVendor. The unsafe flavor is getJoystickVendor .
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_GetJoystickVendor, defined at SDL3/SDL_joystick.h 875:36

Since: 3.2.0

getJoystickProduct Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the USB product ID of an opened joystick, if available.

If the product ID isn't available this function returns 0.

Returns
the USB product ID of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickProduct. The safe flavor is getJoystickProductSafe .
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_GetJoystickProduct, defined at SDL3/SDL_joystick.h 891:36

Since: 3.2.0

getJoystickProductSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the USB product ID of an opened joystick, if available.

If the product ID isn't available this function returns 0.

Returns
the USB product ID of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickProduct. The unsafe flavor is getJoystickProduct .
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_GetJoystickProduct, defined at SDL3/SDL_joystick.h 891:36

Since: 3.2.0

getJoystickProductVersion Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the product version of an opened joystick, if available.

If the product version isn't available this function returns 0.

Returns
the product version of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductVersionForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickProductVersion. The safe flavor is getJoystickProductVersionSafe .
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_GetJoystickProductVersion, defined at SDL3/SDL_joystick.h 907:36

Since: 3.2.0

getJoystickProductVersionSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the product version of an opened joystick, if available.

If the product version isn't available this function returns 0.

Returns
the product version of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickProductVersionForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickProductVersion. The unsafe flavor is getJoystickProductVersion .
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_GetJoystickProductVersion, defined at SDL3/SDL_joystick.h 907:36

Since: 3.2.0

getJoystickFirmwareVersion Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the firmware version of an opened joystick, if available.

If the firmware version isn't available this function returns 0.

Returns
the firmware version of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickFirmwareVersion. The safe flavor is getJoystickFirmwareVersionSafe .
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_GetJoystickFirmwareVersion, defined at SDL3/SDL_joystick.h 922:36

Since: 3.2.0

getJoystickFirmwareVersionSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO Word16 

Get the firmware version of an opened joystick, if available.

If the firmware version isn't available this function returns 0.

Returns
the firmware version of the selected joystick, or 0 if unavailable.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickFirmwareVersion. The unsafe flavor is getJoystickFirmwareVersion .
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_GetJoystickFirmwareVersion, defined at SDL3/SDL_joystick.h 922:36

Since: 3.2.0

getJoystickSerial Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the serial number of an opened joystick, if available.

Returns the serial number of the joystick, or NULL if it is not available.

Returns
the serial number of the selected joystick, or NULL if unavailable.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickSerial. The safe flavor is getJoystickSerialSafe .
C declaration
SDL_GetJoystickSerial, defined at SDL3/SDL_joystick.h 937:42

Since: 3.2.0

getJoystickSerialSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO (PtrConst CChar) 

Get the serial number of an opened joystick, if available.

Returns the serial number of the joystick, or NULL if it is not available.

Returns
the serial number of the selected joystick, or NULL if unavailable.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickSerial. The unsafe flavor is getJoystickSerial .
C declaration
SDL_GetJoystickSerial, defined at SDL3/SDL_joystick.h 937:42

Since: 3.2.0

getJoystickType Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_JoystickType 

Get the type of an opened joystick.

Returns
the SDL_JoystickType of the selected joystick.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickTypeForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickType. The safe flavor is getJoystickTypeSafe .
C declaration
SDL_GetJoystickType, defined at SDL3/SDL_joystick.h 951:46

Since: 3.2.0

getJoystickTypeSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick obtained from openJoystick.
-> IO SDL_JoystickType 

Get the type of an opened joystick.

Returns
the SDL_JoystickType of the selected joystick.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickTypeForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickType. The unsafe flavor is getJoystickType .
C declaration
SDL_GetJoystickType, defined at SDL3/SDL_joystick.h 951:46

Since: 3.2.0

getJoystickGUIDInfo Source #

Arguments

:: SDL_GUID
guid
the SDL_GUID you wish to get info about.
-> Ptr Uint16
vendor
a pointer filled in with the device VID, or 0 if not available.
-> Ptr Uint16
product
a pointer filled in with the device PID, or 0 if not available.
-> Ptr Uint16
version
a pointer filled in with the device version, or 0 if not available.
-> Ptr Uint16
crc16
a pointer filled in with a CRC used to distinguish different products with the same VID/PID, or 0 if not available.
-> IO () 

Get the device information encoded in a SDL_GUID structure.

Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUIDForID

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickGUIDInfo. The safe flavor is getJoystickGUIDInfoSafe .
C declaration
SDL_GetJoystickGUIDInfo, defined at SDL3/SDL_joystick.h 972:34

Since: 3.2.0

getJoystickGUIDInfoSafe Source #

Arguments

:: SDL_GUID
guid
the SDL_GUID you wish to get info about.
-> Ptr Uint16
vendor
a pointer filled in with the device VID, or 0 if not available.
-> Ptr Uint16
product
a pointer filled in with the device PID, or 0 if not available.
-> Ptr Uint16
version
a pointer filled in with the device version, or 0 if not available.
-> Ptr Uint16
crc16
a pointer filled in with a CRC used to distinguish different products with the same VID/PID, or 0 if not available.
-> IO () 

Get the device information encoded in a SDL_GUID structure.

Thread safety
It is safe to call this function from any thread.
See also
getJoystickGUIDForID

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickGUIDInfo. The unsafe flavor is getJoystickGUIDInfo .
C declaration
SDL_GetJoystickGUIDInfo, defined at SDL3/SDL_joystick.h 972:34

Since: 3.2.0

joystickConnected Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> IO Bool 

Get the status of a specified joystick.

Returns
true if the joystick has been opened, false if it has not; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_JoystickConnected. The safe flavor is joystickConnectedSafe .
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_JoystickConnected, defined at SDL3/SDL_joystick.h 985:34

Since: 3.2.0

joystickConnectedSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> IO Bool 

Get the status of a specified joystick.

Returns
true if the joystick has been opened, false if it has not; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_JoystickConnected. The unsafe flavor is joystickConnected .
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_JoystickConnected, defined at SDL3/SDL_joystick.h 985:34

Since: 3.2.0

getJoystickID Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO SDL_JoystickID 

Get the instance ID of an opened joystick.

Returns
the instance ID of the specified joystick on success or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickID. The safe flavor is getJoystickIDSafe .
C declaration
SDL_GetJoystickID, defined at SDL3/SDL_joystick.h 998:44

Since: 3.2.0

getJoystickIDSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO SDL_JoystickID 

Get the instance ID of an opened joystick.

Returns
the instance ID of the specified joystick on success or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickID. The unsafe flavor is getJoystickID .
C declaration
SDL_GetJoystickID, defined at SDL3/SDL_joystick.h 998:44

Since: 3.2.0

getNumJoystickAxes Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of general axis controls on a joystick.

Often, the directional pad on a game controller will either look like 4 separate buttons or a POV hat, and not axes, but all of this is up to the device and platform.

Returns
the number of axis controls/number of axes on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickAxis, getNumJoystickBalls, getNumJoystickButtons, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetNumJoystickAxes. The safe flavor is getNumJoystickAxesSafe .
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_GetNumJoystickAxes, defined at SDL3/SDL_joystick.h 1020:33

Since: 3.2.0

getNumJoystickAxesSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of general axis controls on a joystick.

Often, the directional pad on a game controller will either look like 4 separate buttons or a POV hat, and not axes, but all of this is up to the device and platform.

Returns
the number of axis controls/number of axes on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickAxis, getNumJoystickBalls, getNumJoystickButtons, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetNumJoystickAxes. The unsafe flavor is getNumJoystickAxes .
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_GetNumJoystickAxes, defined at SDL3/SDL_joystick.h 1020:33

Since: 3.2.0

getNumJoystickBalls Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of trackballs on a joystick.

Joystick trackballs have only relative motion events associated with them and their state cannot be polled.

Most joysticks do not have trackballs.

Returns
the number of trackballs on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickBall, getNumJoystickAxes, getNumJoystickButtons, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetNumJoystickBalls. The safe flavor is getNumJoystickBallsSafe .
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_GetNumJoystickBalls, defined at SDL3/SDL_joystick.h 1043:33

Since: 3.2.0

getNumJoystickBallsSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of trackballs on a joystick.

Joystick trackballs have only relative motion events associated with them and their state cannot be polled.

Most joysticks do not have trackballs.

Returns
the number of trackballs on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickBall, getNumJoystickAxes, getNumJoystickButtons, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetNumJoystickBalls. The unsafe flavor is getNumJoystickBalls .
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_GetNumJoystickBalls, defined at SDL3/SDL_joystick.h 1043:33

Since: 3.2.0

getNumJoystickHats Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of POV hats on a joystick.

Returns
the number of POV hats on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickHat, getNumJoystickAxes, getNumJoystickBalls, getNumJoystickButtons

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetNumJoystickHats. The safe flavor is getNumJoystickHatsSafe .
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_GetNumJoystickHats, defined at SDL3/SDL_joystick.h 1061:33

Since: 3.2.0

getNumJoystickHatsSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of POV hats on a joystick.

Returns
the number of POV hats on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickHat, getNumJoystickAxes, getNumJoystickBalls, getNumJoystickButtons

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetNumJoystickHats. The unsafe flavor is getNumJoystickHats .
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_GetNumJoystickHats, defined at SDL3/SDL_joystick.h 1061:33

Since: 3.2.0

getNumJoystickButtons Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of buttons on a joystick.

Returns
the number of buttons on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickButton, getNumJoystickAxes, getNumJoystickBalls, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetNumJoystickButtons. The safe flavor is getNumJoystickButtonsSafe .
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_GetNumJoystickButtons, defined at SDL3/SDL_joystick.h 1079:33

Since: 3.2.0

getNumJoystickButtonsSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> IO Int32 

Get the number of buttons on a joystick.

Returns
the number of buttons on success or -1 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getJoystickButton, getNumJoystickAxes, getNumJoystickBalls, getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetNumJoystickButtons. The unsafe flavor is getNumJoystickButtons .
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_GetNumJoystickButtons, defined at SDL3/SDL_joystick.h 1079:33

Since: 3.2.0

setJoystickEventsEnabled Source #

Arguments

:: Bool
enabled
whether to process joystick events or not.
-> IO () 

Set the state of joystick event processing.

If joystick events are disabled, you must call updateJoysticks yourself and check the state of the joystick when you want joystick information.

Thread safety
It is safe to call this function from any thread.
See also
joystickEventsEnabled, updateJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickEventsEnabled. The safe flavor is setJoystickEventsEnabledSafe .
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_SetJoystickEventsEnabled, defined at SDL3/SDL_joystick.h 1097:34

Since: 3.2.0

setJoystickEventsEnabledSafe Source #

Arguments

:: Bool
enabled
whether to process joystick events or not.
-> IO () 

Set the state of joystick event processing.

If joystick events are disabled, you must call updateJoysticks yourself and check the state of the joystick when you want joystick information.

Thread safety
It is safe to call this function from any thread.
See also
joystickEventsEnabled, updateJoysticks

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickEventsEnabled. The unsafe flavor is setJoystickEventsEnabled .
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_SetJoystickEventsEnabled, defined at SDL3/SDL_joystick.h 1097:34

Since: 3.2.0

joystickEventsEnabled :: IO Bool Source #

Query the state of joystick event processing.

If joystick events are disabled, you must call updateJoysticks yourself and check the state of the joystick when you want joystick information.

Returns
true if joystick events are being processed, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickEventsEnabled

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_JoystickEventsEnabled. The safe flavor is joystickEventsEnabledSafe .
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_JoystickEventsEnabled, defined at SDL3/SDL_joystick.h 1114:34

Since: 3.2.0

joystickEventsEnabledSafe :: IO Bool Source #

Query the state of joystick event processing.

If joystick events are disabled, you must call updateJoysticks yourself and check the state of the joystick when you want joystick information.

Returns
true if joystick events are being processed, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
setJoystickEventsEnabled

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_JoystickEventsEnabled. The unsafe flavor is joystickEventsEnabled .
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_JoystickEventsEnabled, defined at SDL3/SDL_joystick.h 1114:34

Since: 3.2.0

updateJoysticks :: IO () Source #

Update the current state of the open joysticks.

This is called automatically by the event loop if any joystick events are enabled.

Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_UpdateJoysticks. The safe flavor is updateJoysticksSafe : virtual-device callbacks run synchronously.
C declaration
SDL_UpdateJoysticks, defined at SDL3/SDL_joystick.h 1126:34

Since: 3.2.0

updateJoysticksSafe :: IO () Source #

Update the current state of the open joysticks.

This is called automatically by the event loop if any joystick events are enabled.

Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_UpdateJoysticks. The unsafe flavor is updateJoysticks : virtual-device callbacks run synchronously.
C declaration
SDL_UpdateJoysticks, defined at SDL3/SDL_joystick.h 1126:34

Since: 3.2.0

getJoystickAxis Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
axis
the axis to query; the axis indices start at index 0.
-> IO Int16 

Get the current state of an axis control on a joystick.

SDL makes no promises about what part of the joystick any given axis refers to. Your game should have some sort of configuration UI to let users specify what each axis should be bound to. Alternately, SDL's higher-level Game Controller API makes a great effort to apply order to this lower-level interface, so you know that a specific axis is the "left thumb stick," etc.

The value returned by getJoystickAxis is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.

Returns
a 16-bit signed integer representing the current position of the axis or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickAxes

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickAxis. The safe flavor is getJoystickAxisSafe .
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_GetJoystickAxis, defined at SDL3/SDL_joystick.h 1152:36

Since: 3.2.0

getJoystickAxisSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
axis
the axis to query; the axis indices start at index 0.
-> IO Int16 

Get the current state of an axis control on a joystick.

SDL makes no promises about what part of the joystick any given axis refers to. Your game should have some sort of configuration UI to let users specify what each axis should be bound to. Alternately, SDL's higher-level Game Controller API makes a great effort to apply order to this lower-level interface, so you know that a specific axis is the "left thumb stick," etc.

The value returned by getJoystickAxis is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.

Returns
a 16-bit signed integer representing the current position of the axis or 0 on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickAxes

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickAxis. The unsafe flavor is getJoystickAxis .
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_GetJoystickAxis, defined at SDL3/SDL_joystick.h 1152:36

Since: 3.2.0

getJoystickAxisInitialState Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
axis
the axis to query; the axis indices start at index 0.
-> Ptr Sint16
state
upon return, the initial value is supplied here.
-> IO Bool 

Get the initial state of an axis control on a joystick.

The state is a value ranging from -32768 to 32767.

The axis indices start at index 0.

Returns
true if this axis has any initial value, or false if not.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickAxisInitialState. The safe flavor is getJoystickAxisInitialStateSafe .
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_GetJoystickAxisInitialState, defined at SDL3/SDL_joystick.h 1170:34

Since: 3.2.0

getJoystickAxisInitialStateSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
axis
the axis to query; the axis indices start at index 0.
-> Ptr Sint16
state
upon return, the initial value is supplied here.
-> IO Bool 

Get the initial state of an axis control on a joystick.

The state is a value ranging from -32768 to 32767.

The axis indices start at index 0.

Returns
true if this axis has any initial value, or false if not.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickAxisInitialState. The unsafe flavor is getJoystickAxisInitialState .
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_GetJoystickAxisInitialState, defined at SDL3/SDL_joystick.h 1170:34

Since: 3.2.0

getJoystickBall Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick to query.
-> Int32
ball
the ball index to query; ball indices start at index 0.
-> Ptr CInt
dx
stores the difference in the x axis position since the last poll.
-> Ptr CInt
dy
stores the difference in the y axis position since the last poll.
-> IO Bool 

Get the ball axis change since the last poll.

Trackballs can only return relative motion since the last call to getJoystickBall, these motion deltas are placed into dx and dy.

Most joysticks do not have trackballs.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickBalls

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickBall. The safe flavor is getJoystickBallSafe .
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_GetJoystickBall, defined at SDL3/SDL_joystick.h 1193:34

Since: 3.2.0

getJoystickBallSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the SDL_Joystick to query.
-> Int32
ball
the ball index to query; ball indices start at index 0.
-> Ptr CInt
dx
stores the difference in the x axis position since the last poll.
-> Ptr CInt
dy
stores the difference in the y axis position since the last poll.
-> IO Bool 

Get the ball axis change since the last poll.

Trackballs can only return relative motion since the last call to getJoystickBall, these motion deltas are placed into dx and dy.

Most joysticks do not have trackballs.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickBalls

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickBall. The unsafe flavor is getJoystickBall .
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_GetJoystickBall, defined at SDL3/SDL_joystick.h 1193:34

Since: 3.2.0

getJoystickHat Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
hat
the hat index to get the state from; indices start at index 0.
-> IO Word8 

Get the current state of a POV hat on a joystick.

The returned value will be one of the SDL_HAT_* values.

Returns
the current hat position.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickHat. The safe flavor is getJoystickHatSafe .
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_GetJoystickHat, defined at SDL3/SDL_joystick.h 1210:35

Since: 3.2.0

getJoystickHatSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
hat
the hat index to get the state from; indices start at index 0.
-> IO Word8 

Get the current state of a POV hat on a joystick.

The returned value will be one of the SDL_HAT_* values.

Returns
the current hat position.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickHats

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickHat. The unsafe flavor is getJoystickHat .
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_GetJoystickHat, defined at SDL3/SDL_joystick.h 1210:35

Since: 3.2.0

getJoystickButton Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
button
the button index to get the state from; indices start at index 0.
-> IO Bool 

Get the current state of a button on a joystick.

Returns
true if the button is pressed, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickButtons

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickButton. The safe flavor is getJoystickButtonSafe .
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_GetJoystickButton, defined at SDL3/SDL_joystick.h 1236:34

Since: 3.2.0

getJoystickButtonSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
an SDL_Joystick structure containing joystick information.
-> Int32
button
the button index to get the state from; indices start at index 0.
-> IO Bool 

Get the current state of a button on a joystick.

Returns
true if the button is pressed, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
getNumJoystickButtons

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickButton. The unsafe flavor is getJoystickButton .
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_GetJoystickButton, defined at SDL3/SDL_joystick.h 1236:34

Since: 3.2.0

rumbleJoystick Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to vibrate.
-> Word16
low_frequency_rumble
the intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF.
-> Word16
high_frequency_rumble
the intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF.
-> Word32
duration_ms
the duration of the rumble effect, in milliseconds.
-> IO Bool 

Start a rumble effect.

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, or false if rumble isn't supported on this joystick.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_RumbleJoystick. The safe flavor is rumbleJoystickSafe : a virtual joystick's rumble callback runs synchronously.
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_RumbleJoystick, defined at SDL3/SDL_joystick.h 1259:34

Since: 3.2.0

rumbleJoystickSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to vibrate.
-> Word16
low_frequency_rumble
the intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF.
-> Word16
high_frequency_rumble
the intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF.
-> Word32
duration_ms
the duration of the rumble effect, in milliseconds.
-> IO Bool 

Start a rumble effect.

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, or false if rumble isn't supported on this joystick.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_RumbleJoystick. The unsafe flavor is rumbleJoystick : a virtual joystick's rumble callback runs synchronously.
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_RumbleJoystick, defined at SDL3/SDL_joystick.h 1259:34

Since: 3.2.0

rumbleJoystickTriggers Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to vibrate.
-> Word16
left_rumble
the intensity of the left trigger rumble motor, from 0 to 0xFFFF.
-> Word16
right_rumble
the intensity of the right trigger rumble motor, from 0 to 0xFFFF.
-> Word32
duration_ms
the duration of the rumble effect, in milliseconds.
-> IO Bool 

Start a rumble effect in the joystick'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 game controller as a whole. This is currently only supported on Xbox One controllers. If you want the (more common) whole-controller rumble, use rumbleJoystick instead.

This function requires you to process SDL events or call updateJoysticks to update rumble state.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
rumbleJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_RumbleJoystickTriggers. The safe flavor is rumbleJoystickTriggersSafe .
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_RumbleJoystickTriggers, defined at SDL3/SDL_joystick.h 1290:34

Since: 3.2.0

rumbleJoystickTriggersSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to vibrate.
-> Word16
left_rumble
the intensity of the left trigger rumble motor, from 0 to 0xFFFF.
-> Word16
right_rumble
the intensity of the right trigger rumble motor, from 0 to 0xFFFF.
-> Word32
duration_ms
the duration of the rumble effect, in milliseconds.
-> IO Bool 

Start a rumble effect in the joystick'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 game controller as a whole. This is currently only supported on Xbox One controllers. If you want the (more common) whole-controller rumble, use rumbleJoystick instead.

This function requires you to process SDL events or call updateJoysticks to update rumble state.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.
See also
rumbleJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_RumbleJoystickTriggers. The unsafe flavor is rumbleJoystickTriggers .
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_RumbleJoystickTriggers, defined at SDL3/SDL_joystick.h 1290:34

Since: 3.2.0

setJoystickLED Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to update.
-> Word8
red
the intensity of the red LED.
-> Word8
green
the intensity of the green LED.
-> Word8
blue
the intensity of the blue LED.
-> IO Bool 

Update a joystick's LED color.

An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.

For joysticks 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 getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SetJoystickLED. The safe flavor is setJoystickLEDSafe .
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_SetJoystickLED, defined at SDL3/SDL_joystick.h 1312:34

Since: 3.2.0

setJoystickLEDSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to update.
-> Word8
red
the intensity of the red LED.
-> Word8
green
the intensity of the green LED.
-> Word8
blue
the intensity of the blue LED.
-> IO Bool 

Update a joystick's LED color.

An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.

For joysticks 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 getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SetJoystickLED. The unsafe flavor is setJoystickLED .
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_SetJoystickLED, defined at SDL3/SDL_joystick.h 1312:34

Since: 3.2.0

sendJoystickEffect Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to affect.
-> PtrConst Void
data
the data to send to the joystick.
-> Int32
size
the size of the data to send to the joystick.
-> IO Bool 

Send a joystick specific effect packet.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_SendJoystickEffect. The safe flavor is sendJoystickEffectSafe : a virtual joystick's effect callback runs synchronously.
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_SendJoystickEffect, defined at SDL3/SDL_joystick.h 1327:34

Since: 3.2.0

sendJoystickEffectSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to affect.
-> PtrConst Void
data
the data to send to the joystick.
-> Int32
size
the size of the data to send to the joystick.
-> IO Bool 

Send a joystick specific effect packet.

Returns
true on success or false on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_SendJoystickEffect. The unsafe flavor is sendJoystickEffect : a virtual joystick's effect callback runs synchronously.
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_SendJoystickEffect, defined at SDL3/SDL_joystick.h 1327:34

Since: 3.2.0

closeJoystick Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick device to close.
-> IO () 

Close a joystick previously opened with openJoystick.

Thread safety
It is safe to call this function from any thread.
See also
openJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_CloseJoystick. The safe flavor is closeJoystickSafe .
C declaration
SDL_CloseJoystick, defined at SDL3/SDL_joystick.h 1340:34

Since: 3.2.0

closeJoystickSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick device to close.
-> IO () 

Close a joystick previously opened with openJoystick.

Thread safety
It is safe to call this function from any thread.
See also
openJoystick

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_CloseJoystick. The unsafe flavor is closeJoystick .
C declaration
SDL_CloseJoystick, defined at SDL3/SDL_joystick.h 1340:34

Since: 3.2.0

getJoystickConnectionState Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> IO SDL_JoystickConnectionState 

Get the connection state of a joystick.

Returns
the connection state on success or SDL_JOYSTICK_CONNECTION_INVALID on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickConnectionState. The safe flavor is getJoystickConnectionStateSafe .
C declaration
SDL_GetJoystickConnectionState, defined at SDL3/SDL_joystick.h 1354:57

Since: 3.2.0

getJoystickConnectionStateSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> IO SDL_JoystickConnectionState 

Get the connection state of a joystick.

Returns
the connection state on success or SDL_JOYSTICK_CONNECTION_INVALID on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickConnectionState. The unsafe flavor is getJoystickConnectionState .
C declaration
SDL_GetJoystickConnectionState, defined at SDL3/SDL_joystick.h 1354:57

Since: 3.2.0

getJoystickPowerInfo Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> Ptr CInt
percent
a pointer filled in with the percentage of battery life left, between 0 and 100, or NULL to ignore. This will be filled in with -1 we can't determine a value or there is no battery.
-> IO SDL_PowerState 

Get the battery state of a joystick.

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 or SDL_POWERSTATE_ERROR on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetJoystickPowerInfo. The safe flavor is getJoystickPowerInfoSafe .
C declaration
SDL_GetJoystickPowerInfo, defined at SDL3/SDL_joystick.h 1377:44

Since: 3.2.0

getJoystickPowerInfoSafe Source #

Arguments

:: Ptr SDL_Joystick
joystick
the joystick to query.
-> Ptr CInt
percent
a pointer filled in with the percentage of battery life left, between 0 and 100, or NULL to ignore. This will be filled in with -1 we can't determine a value or there is no battery.
-> IO SDL_PowerState 

Get the battery state of a joystick.

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 or SDL_POWERSTATE_ERROR on failure; call getError for more information.
Thread safety
It is safe to call this function from any thread.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetJoystickPowerInfo. The unsafe flavor is getJoystickPowerInfo .
C declaration
SDL_GetJoystickPowerInfo, defined at SDL3/SDL_joystick.h 1377:44

Since: 3.2.0