annotate src/events/SDL_touch.c @ 4683:15dfe42edbfd

Fixed gestureMulti. Disabled dollar gesture temporarily.
author Jim Grandpre <jim.tla@gmail.com>
date Wed, 04 Aug 2010 23:17:30 -0400
parents 5378f2d0754f
children f9ab8df6d45a
rev   line source
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
1 /*
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
4
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
9
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
13 Lesser General Public License for more details.
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
14
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
18
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
19 Sam Lantinga
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
21 */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
22 #include "SDL_config.h"
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
23
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
24 /* General touch handling code for SDL */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
25
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
26 #include "SDL_events.h"
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
27 #include "SDL_events_c.h"
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
28 #include "../video/SDL_sysvideo.h"
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
29
4648
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
30 #include <stdio.h>
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
31
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
32
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
33 static int SDL_num_touch = 0;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
34 static SDL_Touch **SDL_touchPads = NULL;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
35
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
36
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
37 /* Public functions */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
38 int
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
39 SDL_TouchInit(void)
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
40 {
4667
0ecdbabdd7e7 Fixed Warning related to SDL_GestureAddTouch
Jim Grandpre <jim.tla@gmail.com>
parents: 4657
diff changeset
41 return (0);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
42 }
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
43
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
44 SDL_Touch *
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
45 SDL_GetTouch(SDL_TouchID id)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
46 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
47 int index = SDL_GetTouchIndexId(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
48 if (index < 0 || index >= SDL_num_touch) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
49 return NULL;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
50 }
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
51 return SDL_touchPads[index];
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
52 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
53
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
54 SDL_Touch *
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
55 SDL_GetTouchIndex(int index)
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
56 {
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
57 if (index < 0 || index >= SDL_num_touch) {
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
58 return NULL;
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
59 }
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
60 return SDL_touchPads[index];
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
61 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
62
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
63 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
64 SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid)
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
65 {
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
66 int i;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
67 for(i = 0;i < touch->num_fingers;i++)
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
68 if(touch->fingers[i]->id == fingerid)
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
69 return i;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
70 return -1;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
71 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
72
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
73
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
74 SDL_Finger *
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
75 SDL_GetFinger(SDL_Touch* touch,SDL_FingerID id)
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
76 {
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
77 int index = SDL_GetFingerIndexId(touch,id);
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
78 if(index < 0 || index >= touch->num_fingers)
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
79 return NULL;
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
80 return touch->fingers[index];
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
81 }
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
82
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
83
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
84 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
85 SDL_GetTouchIndexId(SDL_TouchID id)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
86 {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
87 int index;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
88 SDL_Touch *touch;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
89
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
90 for (index = 0; index < SDL_num_touch; ++index) {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
91 touch = SDL_touchPads[index];
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
92 if (touch->id == id) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
93 return index;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
94 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
95 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
96 return -1;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
97 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
98
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
99 int
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
100 SDL_AddTouch(const SDL_Touch * touch, char *name)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
101 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
102 SDL_Touch **touchPads;
4648
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
103 int index,length;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
104
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
105 if (SDL_GetTouchIndexId(touch->id) != -1) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
106 SDL_SetError("Touch ID already in use");
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
107 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
108
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
109 /* Add the touch to the list of touch */
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
110 touchPads = (SDL_Touch **) SDL_realloc(SDL_touchPads,
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
111 (SDL_num_touch + 1) * sizeof(*touch));
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
112 if (!touchPads) {
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
113 SDL_OutOfMemory();
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
114 return -1;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
115 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
116
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
117 SDL_touchPads = touchPads;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
118 index = SDL_num_touch++;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
119
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
120 SDL_touchPads[index] = (SDL_Touch *) SDL_malloc(sizeof(*SDL_touchPads[index]));
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
121 if (!SDL_touchPads[index]) {
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
122 SDL_OutOfMemory();
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
123 return -1;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
124 }
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
125 *SDL_touchPads[index] = *touch;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
126
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
127 /* we're setting the touch properties */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
128 length = 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
129 length = SDL_strlen(name);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
130 SDL_touchPads[index]->focus = 0;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
131 SDL_touchPads[index]->name = SDL_malloc((length + 2) * sizeof(char));
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
132 SDL_strlcpy(SDL_touchPads[index]->name, name, length + 1);
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
133
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
134 SDL_touchPads[index]->num_fingers = 0;
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
135 SDL_touchPads[index]->max_fingers = 1;
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
136 SDL_touchPads[index]->fingers = (SDL_Finger **) SDL_malloc(sizeof(SDL_Finger*));
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
137 SDL_touchPads[index]->fingers[0] = NULL;
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
138 SDL_touchPads[index]->buttonstate = 0;
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
139 SDL_touchPads[index]->relative_mode = SDL_FALSE;
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
140 SDL_touchPads[index]->flush_motion = SDL_FALSE;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
141
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
142 SDL_touchPads[index]->xres = (1<<(16-1));
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
143 SDL_touchPads[index]->yres = (1<<(16-1));
4657
eed063a0bf5b Moved Multi finger gesture recognition into the library.
Jim Grandpre <jim.tla@gmail.com>
parents: 4655
diff changeset
144 //Do I want this here? Probably
eed063a0bf5b Moved Multi finger gesture recognition into the library.
Jim Grandpre <jim.tla@gmail.com>
parents: 4655
diff changeset
145 SDL_GestureAddTouch(SDL_touchPads[index]);
eed063a0bf5b Moved Multi finger gesture recognition into the library.
Jim Grandpre <jim.tla@gmail.com>
parents: 4655
diff changeset
146
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
147 return index;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
148 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
149
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
150 void
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
151 SDL_DelTouch(SDL_TouchID id)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
152 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
153 int index = SDL_GetTouchIndexId(id);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
154 SDL_Touch *touch = SDL_GetTouch(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
155
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
156 if (!touch) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
157 return;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
158 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
159
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
160
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
161 SDL_free(touch->name);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
162
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
163 if (touch->FreeTouch) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
164 touch->FreeTouch(touch);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
165 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
166 SDL_free(touch);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
167
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
168 SDL_num_touch--;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
169 SDL_touchPads[index] = SDL_touchPads[SDL_num_touch];
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
170 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
171
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
172 void
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
173 SDL_TouchQuit(void)
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
174 {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
175 int i;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
176
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
177 for (i = SDL_num_touch-1; i > 0 ; --i) {
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
178 SDL_DelTouch(i);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
179 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
180 SDL_num_touch = 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
181
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
182 if (SDL_touchPads) {
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
183 SDL_free(SDL_touchPads);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
184 SDL_touchPads = NULL;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
185 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
186 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
187
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
188 int
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
189 SDL_GetNumTouch(void)
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
190 {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
191 return SDL_num_touch;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
192 }
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
193 SDL_Window *
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
194 SDL_GetTouchFocusWindow(SDL_TouchID id)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
195 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
196 SDL_Touch *touch = SDL_GetTouch(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
197
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
198 if (!touch) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
199 return 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
200 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
201 return touch->focus;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
202 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
203
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
204 void
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
205 SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
206 {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
207 int index = SDL_GetTouchIndexId(id);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
208 SDL_Touch *touch = SDL_GetTouch(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
209 int i;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
210 SDL_bool focus;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
211
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
212 if (!touch || (touch->focus == window)) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
213 return;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
214 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
215
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
216 /* See if the current window has lost focus */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
217 if (touch->focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
218 focus = SDL_FALSE;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
219 for (i = 0; i < SDL_num_touch; ++i) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
220 SDL_Touch *check;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
221 if (i != index) {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
222 check = SDL_touchPads[i];
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
223 if (check && check->focus == touch->focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
224 focus = SDL_TRUE;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
225 break;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
226 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
227 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
228 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
229 if (!focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
230 SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
231 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
232 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
233
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
234 touch->focus = window;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
235
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
236 if (touch->focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
237 focus = SDL_FALSE;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
238 for (i = 0; i < SDL_num_touch; ++i) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
239 SDL_Touch *check;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
240 if (i != index) {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
241 check = SDL_touchPads[i];
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
242 if (check && check->focus == touch->focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
243 focus = SDL_TRUE;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
244 break;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
245 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
246 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
247 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
248 if (!focus) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
249 SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
250 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
251 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
252 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
253
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
254 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
255 SDL_AddFinger(SDL_Touch* touch,SDL_Finger *finger)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
256 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
257 int index;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
258 SDL_Finger **fingers;
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
259 //printf("Adding Finger...\n");
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
260 if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
261 SDL_SetError("Finger ID already in use");
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
262 }
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
263
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
264 /* Add the touch to the list of touch */
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
265 if(touch->num_fingers >= touch->max_fingers){
4648
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
266 //printf("Making room for it!\n");
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
267 fingers = (SDL_Finger **) SDL_realloc(touch->fingers,
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
268 (touch->num_fingers + 1) * sizeof(SDL_Finger *));
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
269 touch->max_fingers = touch->num_fingers+1;
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
270 if (!fingers) {
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
271 SDL_OutOfMemory();
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
272 return -1;
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
273 } else {
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
274 touch->max_fingers = touch->num_fingers+1;
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
275 touch->fingers = fingers;
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
276 }
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
277 }
4645
0375d020e7e3 Auto-detects Wacom touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4644
diff changeset
278
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
279 index = touch->num_fingers;
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
280 //printf("Max_Fingers: %i Index: %i\n",touch->max_fingers,index);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
281
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
282 touch->fingers[index] = (SDL_Finger *) SDL_malloc(sizeof(SDL_Finger));
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
283 if (!touch->fingers[index]) {
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
284 SDL_OutOfMemory();
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
285 return -1;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
286 }
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
287 *(touch->fingers[index]) = *finger;
4646
eea1bf53effa Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents: 4645
diff changeset
288 touch->num_fingers++;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
289
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
290 return index;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
291 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
292
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
293 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
294 SDL_DelFinger(SDL_Touch* touch,SDL_FingerID fingerid)
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
295 {
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
296 int index = SDL_GetFingerIndexId(touch,fingerid);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
297 SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
298
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
299 if (!finger) {
4648
0350b634c044 Fixed windo build errors. Should now be compilable.
jimtla
parents: 4646
diff changeset
300 return -1;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
301 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
302
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
303
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
304 SDL_free(finger);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
305 touch->num_fingers--;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
306 touch->fingers[index] = touch->fingers[touch->num_fingers];
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
307 return 0;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
308 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
309
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
310
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
311 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
312 SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down,
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
313 float xin, float yin, float pressurein)
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
314 {
4643
8806b78988f7 Bug fixes. Basic touch events (finger up, finger down, finger move) supported.
Jim Grandpre <jim.tla@gmail.com>
parents: 4642
diff changeset
315 int posted;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
316 SDL_Touch* touch = SDL_GetTouch(id);
4643
8806b78988f7 Bug fixes. Basic touch events (finger up, finger down, finger move) supported.
Jim Grandpre <jim.tla@gmail.com>
parents: 4642
diff changeset
317
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
318 if(!touch) {
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
319 return SDL_TouchNotFoundError(id);
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
320 }
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
321
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
322
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
323 //scale to Integer coordinates
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
324 Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
325 Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
326 Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
327
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
328 SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
329 if(down) {
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
330 if(finger == NULL) {
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
331 SDL_Finger nf;
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
332 nf.id = fingerid;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
333 nf.x = x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
334 nf.y = y;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
335 nf.pressure = pressure;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
336 nf.xdelta = 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
337 nf.ydelta = 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
338 nf.last_x = x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
339 nf.last_y = y;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
340 nf.last_pressure = pressure;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
341 nf.down = SDL_FALSE;
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
342 if(SDL_AddFinger(touch,&nf) < 0) return 0;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
343 finger = SDL_GetFinger(touch,fingerid);
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
344 }
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
345 else if(finger->down) return 0;
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
346 if(xin < touch->x_min || yin < touch->y_min) return 0; //should defer if only a partial input
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
347 posted = 0;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
348 if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
349 SDL_Event event;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
350 event.tfinger.type = SDL_FINGERDOWN;
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
351 event.tfinger.touchId = id;
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
352 event.tfinger.x = x;
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
353 event.tfinger.y = y;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
354 event.tfinger.state = touch->buttonstate;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
355 event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
4643
8806b78988f7 Bug fixes. Basic touch events (finger up, finger down, finger move) supported.
Jim Grandpre <jim.tla@gmail.com>
parents: 4642
diff changeset
356 event.tfinger.fingerId = fingerid;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
357 posted = (SDL_PushEvent(&event) > 0);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
358 }
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
359 if(posted) finger->down = SDL_TRUE;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
360 return posted;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
361 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
362 else {
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
363 if(finger == NULL) {printf("Finger not found...\n");return 0;}
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
364 posted = 0;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
365 if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
366 SDL_Event event;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
367 event.tfinger.type = SDL_FINGERUP;
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
368 event.tfinger.touchId = id;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
369 event.tfinger.state = touch->buttonstate;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
370 event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
4643
8806b78988f7 Bug fixes. Basic touch events (finger up, finger down, finger move) supported.
Jim Grandpre <jim.tla@gmail.com>
parents: 4642
diff changeset
371 event.tfinger.fingerId = fingerid;
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
372 //I don't trust the coordinates passed on fingerUp
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
373 event.tfinger.x = finger->x;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
374 event.tfinger.y = finger->y;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
375 event.tfinger.dx = 0;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
376 event.tfinger.dy = 0;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
377
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
378 if(SDL_DelFinger(touch,fingerid) < 0) return 0;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
379 posted = (SDL_PushEvent(&event) > 0);
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
380 }
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
381 return posted;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
382 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
383 }
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
384
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
385 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
386 SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative,
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
387 float xin, float yin, float pressurein)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
388 {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
389 int index = SDL_GetTouchIndexId(id);
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
390 SDL_Touch *touch = SDL_GetTouch(id);
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
391 SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
392 int posted;
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
393 Sint16 xrel, yrel;
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
394 float x_max = 0, y_max = 0;
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
395
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
396 if (!touch) {
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
397 return SDL_TouchNotFoundError(id);
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
398 }
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
399
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
400 //scale to Integer coordinates
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
401 Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres);
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
402 Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres);
4681
5378f2d0754f Fixed some Gesture bugs
Jim Grandpre <jim.tla@gmail.com>
parents: 4679
diff changeset
403 Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres);
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
404 if(touch->flush_motion) {
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
405 return 0;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
406 }
4654
7dbcd71216df Added $1 gesture recognition.
Jim Grandpre <jim.tla@gmail.com>
parents: 4648
diff changeset
407
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
408 if(finger == NULL || !finger->down) {
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
409 return SDL_SendFingerDown(id,fingerid,SDL_TRUE,xin,yin,pressurein);
4654
7dbcd71216df Added $1 gesture recognition.
Jim Grandpre <jim.tla@gmail.com>
parents: 4648
diff changeset
410 } else {
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
411 /* the relative motion is calculated regarding the last position */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
412 if (relative) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
413 xrel = x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
414 yrel = y;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
415 x = (finger->last_x + x);
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
416 y = (finger->last_y + y);
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
417 } else {
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
418 if(xin < touch->x_min) x = finger->last_x; /*If movement is only in one axis,*/
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
419 if(yin < touch->y_min) y = finger->last_y; /*The other is marked as -1*/
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
420 if(pressurein < touch->pressure_min) pressure = finger->last_pressure;
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
421 xrel = x - finger->last_x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
422 yrel = y - finger->last_y;
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
423 //printf("xrel,yrel (%i,%i)\n",(int)xrel,(int)yrel);
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
424 }
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
425
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
426 /* Drop events that don't change state */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
427 if (!xrel && !yrel) {
4654
7dbcd71216df Added $1 gesture recognition.
Jim Grandpre <jim.tla@gmail.com>
parents: 4648
diff changeset
428 #if 0
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
429 printf("Touch event didn't change state - dropped!\n");
4654
7dbcd71216df Added $1 gesture recognition.
Jim Grandpre <jim.tla@gmail.com>
parents: 4648
diff changeset
430 #endif
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
431 return 0;
4642
057e8762d2a1 Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents: 4641
diff changeset
432 }
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
433
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
434 /* Update internal touch coordinates */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
435
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
436 finger->x = x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
437 finger->y = y;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
438
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
439 /*Should scale to window? Normalize? Maintain Aspect?*/
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
440 //SDL_GetWindowSize(touch->focus, &x_max, &y_max);
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
441
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
442 /* make sure that the pointers find themselves inside the windows */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
443 /* only check if touch->xmax is set ! */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
444 /*
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
445 if (x_max && touch->x > x_max) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
446 touch->x = x_max;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
447 } else if (touch->x < 0) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
448 touch->x = 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
449 }
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
450
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
451 if (y_max && touch->y > y_max) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
452 touch->y = y_max;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
453 } else if (touch->y < 0) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
454 touch->y = 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
455 }
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
456 */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
457 finger->xdelta = xrel;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
458 finger->ydelta = yrel;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
459 finger->pressure = pressure;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
460
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
461
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
462
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
463 /* Post the event, if desired */
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
464 posted = 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
465 if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
466 SDL_Event event;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
467 event.tfinger.type = SDL_FINGERMOTION;
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
468 event.tfinger.touchId = id;
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
469 event.tfinger.fingerId = fingerid;
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
470 event.tfinger.x = x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
471 event.tfinger.y = y;
4683
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
472 event.tfinger.dx = xrel;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
473 event.tfinger.dy = yrel;
15dfe42edbfd Fixed gestureMulti. Disabled dollar gesture temporarily.
Jim Grandpre <jim.tla@gmail.com>
parents: 4681
diff changeset
474
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
475
4655
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
476 event.tfinger.pressure = pressure;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
477 event.tfinger.state = touch->buttonstate;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
478 event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
479 posted = (SDL_PushEvent(&event) > 0);
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
480 }
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
481 finger->last_x = finger->x;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
482 finger->last_y = finger->y;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
483 finger->last_pressure = finger->pressure;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
484 return posted;
4c94f2023d62 Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents: 4654
diff changeset
485 }
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
486 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
487 int
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
488 SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
489 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
490 SDL_Touch *touch = SDL_GetTouch(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
491 int posted;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
492 Uint32 type;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
493
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
494
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
495 if (!touch) {
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
496 return SDL_TouchNotFoundError(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
497 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
498
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
499 /* Figure out which event to perform */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
500 switch (state) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
501 case SDL_PRESSED:
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
502 if (touch->buttonstate & SDL_BUTTON(button)) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
503 /* Ignore this event, no state change */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
504 return 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
505 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
506 type = SDL_TOUCHBUTTONDOWN;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
507 touch->buttonstate |= SDL_BUTTON(button);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
508 break;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
509 case SDL_RELEASED:
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
510 if (!(touch->buttonstate & SDL_BUTTON(button))) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
511 /* Ignore this event, no state change */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
512 return 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
513 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
514 type = SDL_TOUCHBUTTONUP;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
515 touch->buttonstate &= ~SDL_BUTTON(button);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
516 break;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
517 default:
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
518 /* Invalid state -- bail */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
519 return 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
520 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
521
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
522 /* Post the event, if desired */
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
523 posted = 0;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
524 if (SDL_GetEventState(type) == SDL_ENABLE) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
525 SDL_Event event;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
526 event.type = type;
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
527 event.tbutton.touchId = touch->id;
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
528 event.tbutton.state = state;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
529 event.tbutton.button = button;
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
530 event.tbutton.windowID = touch->focus ? touch->focus->id : 0;
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
531 posted = (SDL_PushEvent(&event) > 0);
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
532 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
533 return posted;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
534 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
535
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
536 char *
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
537 SDL_GetTouchName(SDL_TouchID id)
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
538 {
4641
49a97daea6ec Added touch event definitions. Heavily modified events/SDL_touch*.
Jim Grandpre <jim.tla@gmail.com>
parents: 4640
diff changeset
539 SDL_Touch *touch = SDL_GetTouch(id);
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
540 if (!touch) {
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
541 return NULL;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
542 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
543 return touch->name;
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
544 }
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
545
4678
f8431f66613d Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents: 4676
diff changeset
546 int SDL_TouchNotFoundError(SDL_TouchID id) {
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
547 printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id);
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
548 printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
549 int i;
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
550 for(i=0;i < SDL_num_touch;i++) {
4676
99b4560b7aa1 Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents: 4674
diff changeset
551 printf("ERROR: %li\n",SDL_touchPads[i]->id);
4674
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
552 }
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
553 return 0;
89d5e2201b00 Prevented SDL_SendDown from sending on nonexistent touch devices.
Jim Grandpre <jim.tla@gmail.com>
parents: 4667
diff changeset
554 }
4640
f068a6dfc858 Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff changeset
555 /* vi: set ts=4 sw=4 expandtab: */