sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Touch

Description

SDL offers touch input, on platforms that support it. It can manage multiple touch devices and track multiple fingers on those devices.

Touches are mostly dealt with through the event system, in the SDL_EVENT_FINGER_DOWN, SDL_EVENT_FINGER_MOTION, and SDL_EVENT_FINGER_UP events, but there are also functions to query for hardware details, etc.

The touch system, by default, will also send virtual mouse events; this can be useful for making a some desktop apps work on a phone without significant changes. For apps that care about mouse and touch input separately, they should ignore mouse events that have a which field of SDL_TOUCH_MOUSEID. A unique ID for a touch device.

This ID is valid for the time the device is connected to the system, and is never reused for the lifetime of the application.

The value 0 is an invalid ID.

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

Full conventions: SDL3.Sys.

Since: 3.2.0

Synopsis

Documentation

Typed constants

pattern SDL_MOUSE_TOUCHID :: SDL_TouchID Source #

Typed constant for macro SDL_MOUSE_TOUCHID.

pattern SDL_PEN_TOUCHID :: SDL_TouchID Source #

Typed constant for macro SDL_PEN_TOUCHID (declared in SDL_pen.h).

Function aliases

getTouchDevices Source #

Arguments

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

Get a list of registered touch devices.

On some platforms SDL first sees the touch device if it was actually used. Therefore the returned list might be empty, although devices are available. After using all devices at least once the number will be correct.

Returns
a 0 terminated array of touch device IDs or NULL on failure; call getError for more information. This should be freed with free when it is no longer needed.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetTouchDevices. The safe flavor is getTouchDevicesSafe .
C declaration
SDL_GetTouchDevices, defined at SDL3/SDL_touch.h 140:43

Since: 3.2.0

getTouchDevicesSafe Source #

Arguments

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

Get a list of registered touch devices.

On some platforms SDL first sees the touch device if it was actually used. Therefore the returned list might be empty, although devices are available. After using all devices at least once the number will be correct.

Returns
a 0 terminated array of touch device IDs or NULL on failure; call getError for more information. This should be freed with free when it is no longer needed.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetTouchDevices. The unsafe flavor is getTouchDevices .
C declaration
SDL_GetTouchDevices, defined at SDL3/SDL_touch.h 140:43

Since: 3.2.0

getTouchDeviceName Source #

Arguments

:: SDL_TouchID
touchID
the touch device instance ID.
-> IO (PtrConst CChar) 

Get the touch device name as reported from the driver.

Returns
touch device name, or NULL on failure; call getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetTouchDeviceName. The safe flavor is getTouchDeviceNameSafe .
C declaration
SDL_GetTouchDeviceName, defined at SDL3/SDL_touch.h 151:42

Since: 3.2.0

getTouchDeviceNameSafe Source #

Arguments

:: SDL_TouchID
touchID
the touch device instance ID.
-> IO (PtrConst CChar) 

Get the touch device name as reported from the driver.

Returns
touch device name, or NULL on failure; call getError for more information.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetTouchDeviceName. The unsafe flavor is getTouchDeviceName .
C declaration
SDL_GetTouchDeviceName, defined at SDL3/SDL_touch.h 151:42

Since: 3.2.0

getTouchDeviceType Source #

Arguments

:: SDL_TouchID
touchID
the ID of a touch device.
-> IO SDL_TouchDeviceType 

Get the type of the given touch device.

Returns
touch device type.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetTouchDeviceType. The safe flavor is getTouchDeviceTypeSafe .
C declaration
SDL_GetTouchDeviceType, defined at SDL3/SDL_touch.h 161:49

Since: 3.2.0

getTouchDeviceTypeSafe Source #

Arguments

:: SDL_TouchID
touchID
the ID of a touch device.
-> IO SDL_TouchDeviceType 

Get the type of the given touch device.

Returns
touch device type.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetTouchDeviceType. The unsafe flavor is getTouchDeviceType .
C declaration
SDL_GetTouchDeviceType, defined at SDL3/SDL_touch.h 161:49

Since: 3.2.0

getTouchFingers Source #

Arguments

:: SDL_TouchID
touchID
the ID of a touch device.
-> Ptr CInt
count
a pointer filled in with the number of fingers returned, can be NULL.
-> IO (Ptr (Ptr SDL_Finger)) 

Get a list of active fingers for a given touch device.

Returns
a NULL terminated array of SDL_Finger pointers or NULL on failure; call getError for more information. This is a single allocation that should be freed with free when it is no longer needed.

sdl3-bindgen-sys notes

Expand
FFI safety
Unsafe foreign import of SDL_GetTouchFingers. The safe flavor is getTouchFingersSafe .
C declaration
SDL_GetTouchFingers, defined at SDL3/SDL_touch.h 176:43

Since: 3.2.0

getTouchFingersSafe Source #

Arguments

:: SDL_TouchID
touchID
the ID of a touch device.
-> Ptr CInt
count
a pointer filled in with the number of fingers returned, can be NULL.
-> IO (Ptr (Ptr SDL_Finger)) 

Get a list of active fingers for a given touch device.

Returns
a NULL terminated array of SDL_Finger pointers or NULL on failure; call getError for more information. This is a single allocation that should be freed with free when it is no longer needed.

sdl3-bindgen-sys notes

Expand
FFI safety
Safe foreign import of SDL_GetTouchFingers. The unsafe flavor is getTouchFingers .
C declaration
SDL_GetTouchFingers, defined at SDL3/SDL_touch.h 176:43

Since: 3.2.0