Module touch

Available on crate feature dep_sdl3 only.
Expand 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.

Structs§

SDL_Finger
Data about a single finger in a multitouch event.
SDL_TouchDeviceType
An enum that describes the type of a touch device.

Constants§

SDL_MOUSE_TOUCHID
The SDL_TouchID for touch events simulated with mouse input.
SDL_TOUCH_DEVICE_DIRECT
touch screen with window-relative coordinates
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE
trackpad with absolute device coordinates
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE
trackpad with screen cursor-relative coordinates
SDL_TOUCH_DEVICE_INVALID
SDL_TOUCH_MOUSEID
The SDL_MouseID for mouse events simulated with touch input.

Functions§

SDL_GetTouchDeviceName
Get the touch device name as reported from the driver.
SDL_GetTouchDeviceType
Get the type of the given touch device.
SDL_GetTouchDevices
Get a list of registered touch devices.
SDL_GetTouchFingers
Get a list of active fingers for a given touch device.

Type Aliases§

SDL_FingerID
A unique ID for a single finger on a touch device.
SDL_TouchID
A unique ID for a touch device.