summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlex Szpakowski <slime73@gmail.com>2018-11-10 16:15:48 -0400
committerAlex Szpakowski <slime73@gmail.com>2018-11-10 16:15:48 -0400
commite4a845faec1803b3e5c92e2f671f7651cfba4238 (patch)
treed0ddacbea6a26f0f9fdd1da41c432fbc1e278a5c /include
parent9fd857ef3e8b96088bdc8132a330723f002ca2c3 (diff)
Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id).
Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates). Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
Diffstat (limited to 'include')
-rw-r--r--include/SDL_touch.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/SDL_touch.h b/include/SDL_touch.h
index f4075e79a5..926a9e189c 100644
--- a/include/SDL_touch.h
+++ b/include/SDL_touch.h
@@ -41,6 +41,14 @@ extern "C" {
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
+typedef enum
+{
+ SDL_TOUCH_DEVICE_INVALID = -1,
+ 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_TouchDeviceType;
+
typedef struct SDL_Finger
{
SDL_FingerID id;
@@ -66,6 +74,11 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
/**
+ * \brief Get the type of the given touch device.
+ */
+extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
+
+/**
* \brief Get the number of active fingers for a given touch device.
*/
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);