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.
This commit is contained in:
Alex Szpakowski
2018-11-10 16:15:48 -04:00
parent 2196e5765c
commit 5029d50ea8
15 changed files with 109 additions and 15 deletions

View File

@@ -72,7 +72,7 @@ void Android_InitTouch(void)
if (0 < number) {
for (i = 0; i < number; ++i) {
SDL_AddTouch((SDL_TouchID) ids[i], ""); /* no error handling */
SDL_AddTouch((SDL_TouchID) ids[i], SDL_TOUCH_DEVICE_DIRECT, ""); /* no error handling */
}
SDL_free(ids);
}
@@ -97,7 +97,7 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio
}
touchDeviceId = (SDL_TouchID)touch_device_id_in;
if (SDL_AddTouch(touchDeviceId, "") < 0) {
if (SDL_AddTouch(touchDeviceId, SDL_TOUCH_DEVICE_DIRECT, "") < 0) {
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
}