cocoaTouch/iPad/OverlayViewController.m
changeset 3165 3ec07a7d8456
parent 3116 97dc65a47b15
child 3250 d5cd1a617123
equal deleted inserted replaced
3164:569fd65261d0 3165:3ec07a7d8456
   181 #define kMaximumVariance        3
   181 #define kMaximumVariance        3
   182 
   182 
   183 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   183 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
   184 	NSArray *twoTouches;
   184 	NSArray *twoTouches;
   185 	UITouch *touch = [touches anyObject];
   185 	UITouch *touch = [touches anyObject];
   186 	
   186 	int width = [[UIScreen mainScreen] bounds].size.width;
       
   187     
   187 	switch ([touches count]) {
   188 	switch ([touches count]) {
   188 		case 1:
   189 		case 1:
   189 			gestureStartPoint = [touch locationInView:self.view];
   190 			gestureStartPoint = [touch locationInView:self.view];
   190 			initialDistanceForPinching = 0;
   191 			initialDistanceForPinching = 0;
   191 			switch ([touch tapCount]) {
   192 			switch ([touch tapCount]) {
   192 				case 1:
   193 				case 1:
   193 					NSLog(@"X:%d Y:%d", (int)gestureStartPoint.x, (int)gestureStartPoint.y );
   194 					NSLog(@"X:%d Y:%d", (int)gestureStartPoint.x, (int)gestureStartPoint.y );
   194 					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   195 					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   195 							      (int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   196 							      (int)gestureStartPoint.y, width - (int)gestureStartPoint.x);
   196 					HW_click();
   197 					HW_click();
   197 					break;
   198 					break;
   198 				case 2:
   199 				case 2:
   199 					HW_ammoMenu();
   200 					HW_ammoMenu();
   200 					break;
   201 					break;
   233 
   234 
   234 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   235 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   235 	NSArray *twoTouches;
   236 	NSArray *twoTouches;
   236 	CGPoint currentPosition;
   237 	CGPoint currentPosition;
   237 	UITouch *touch = [touches anyObject];
   238 	UITouch *touch = [touches anyObject];
       
   239 	int width = [[UIScreen mainScreen] bounds].size.width;
   238 
   240 
   239 	switch ([touches count]) {
   241 	switch ([touches count]) {
   240 		case 1:
   242 		case 1:
   241 			currentPosition = [touch locationInView:self.view];
   243 			currentPosition = [touch locationInView:self.view];
   242 			// panning
   244 			// panning
   243 			SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   245 			SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
   244 							(int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
   246 							(int)gestureStartPoint.y, width - (int)gestureStartPoint.x);
   245 			// remember that we have x and y inverted
   247 			// remember that we have x and y inverted
   246 			/* temporarily disabling hog movements for camera panning testing
   248 			/* temporarily disabling hog movements for camera panning testing
   247 			CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
   249 			CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
   248 			CGFloat horizDiff = gestureStartPoint.y - currentPosition.y;
   250 			CGFloat horizDiff = gestureStartPoint.y - currentPosition.y;
   249 			CGFloat deltaX = fabsf(vertDiff);
   251 			CGFloat deltaX = fabsf(vertDiff);