comparison src/video/uikit/SDL_uikitview.m @ 4662:3c4e0130c9b1

Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
author Jim Grandpre <jim.tla@gmail.com>
date Tue, 13 Jul 2010 18:31:09 -0400
parents 03dcb795c583
children 31607094315c
comparison
equal deleted inserted replaced
4661:03dcb795c583 4662:3c4e0130c9b1
89 } 89 }
90 90
91 #if FIXED_MULTITOUCH 91 #if FIXED_MULTITOUCH
92 while(touch) { 92 while(touch) {
93 CGPoint locationInView = [touch locationInView: self]; 93 CGPoint locationInView = [touch locationInView: self];
94 SDL_SendFingerDown(touchId,(int)touch, 94
95
96 #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
97 //FIXME: TODO: Using touch as the fingerId is potentially dangerous
98 //It is also much more efficient than storing the UITouch pointer
99 //and comparing it to the incoming event.
100 SDL_SendFingerDown(touchId,(long)touch,
95 SDL_TRUE,locationInView.x,locationInView.y, 101 SDL_TRUE,locationInView.x,locationInView.y,
96 1); 102 1);
103 #else
104 int i;
105 for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
106 if(finger[i] == NULL) {
107 finger[i] = touch;
108 SDL_SendFingerDown(touchId,i,
109 SDL_TRUE,locationInView.x,locationInView.y,
110 1);
111 break;
112 }
113 }
114 #endif
115
116
117
97 118
98 touch = (UITouch*)[enumerator nextObject]; 119 touch = (UITouch*)[enumerator nextObject];
99 } 120 }
100 #endif 121 #endif
101 } 122 }
111 } 132 }
112 133
113 #if FIXED_MULTITOUCH 134 #if FIXED_MULTITOUCH
114 while(touch) { 135 while(touch) {
115 CGPoint locationInView = [touch locationInView: self]; 136 CGPoint locationInView = [touch locationInView: self];
116 SDL_SendFingerDown(touchId,(int)touch, 137
138
139 #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
140 SDL_SendFingerDown(touchId,(long)touch,
117 SDL_FALSE,locationInView.x,locationInView.y, 141 SDL_FALSE,locationInView.x,locationInView.y,
118 1); 142 1);
143 #else
144 int i;
145 for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
146 if(finger[i] == touch) {
147 SDL_SendFingerDown(touchId,i,
148 SDL_FALSE,locationInView.x,locationInView.y,
149 1);
150 break;
151 }
152 }
153 #endif
119 154
120 touch = (UITouch*)[enumerator nextObject]; 155 touch = (UITouch*)[enumerator nextObject];
121 } 156 }
122 #endif 157 #endif
123 } 158 }
144 } 179 }
145 180
146 #if FIXED_MULTITOUCH 181 #if FIXED_MULTITOUCH
147 while(touch) { 182 while(touch) {
148 CGPoint locationInView = [touch locationInView: self]; 183 CGPoint locationInView = [touch locationInView: self];
149 SDL_SendTouchMotion(touchId,(int)touch, 184
150 SDL_FALSE,locationInView.x,locationInView.y, 185
151 1); 186 #ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
187 SDL_SendTouchMotion(touchId,(long)touch,
188 SDL_FALSE,locationInView.x,locationInView.y,
189 1);
190 #else
191 int i;
192 for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
193 if(finger[i] == touch) {
194 SDL_SendTouchMotion(touchId,i,
195 SDL_FALSE,locationInView.x,locationInView.y,
196 1);
197 break;
198 }
199 }
200 #endif
152 201
153 touch = (UITouch*)[enumerator nextObject]; 202 touch = (UITouch*)[enumerator nextObject];
154 } 203 }
155 #endif 204 #endif
156 } 205 }