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_
FingerID - A unique ID for a single finger on a touch device.
- SDL_
Touch Device Type - An enum that describes the type of a touch device.
- SDL_
TouchID - A unique ID for a touch device.
Constants§
- SDL_
MOUSE_ TOUCHID - The
SDL_TouchIDfor 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_MouseIDfor mouse events simulated with touch input.
Functions§
- SDL_
GetTouch ⚠Device Name - Get the touch device name as reported from the driver.
- SDL_
GetTouch ⚠Device Type - Get the type of the given touch device.
- SDL_
GetTouch ⚠Devices - Get a list of registered touch devices.
- SDL_
GetTouch ⚠Fingers - Get a list of active fingers for a given touch device.