smaller improvements in mouse handling
authorkoda
Sun, 31 Jan 2010 22:43:09 +0000
changeset 2734 fb9ad1587054
parent 2733 52a5a160566f
child 2735 f2008d0ce3f8
smaller improvements in mouse handling
cocoaTouch/GameSetup.m
cocoaTouch/SDLOverrides/SDL_uikitview.m
--- a/cocoaTouch/GameSetup.m	Sun Jan 31 22:15:53 2010 +0000
+++ b/cocoaTouch/GameSetup.m	Sun Jan 31 22:43:09 2010 +0000
@@ -98,7 +98,8 @@
 				addteam <color> <team name>
 				addhh <level> <health> <hedgehog name>
 				  <level> is 0 for human, 1-5 for bots (5 is the most stupid)
-				 */
+				ammostore is one byte/number for each ammocount then one for each probability or so
+				*/
 				// local game
 				[self sendToEngine:@"TL"];
 				
@@ -130,7 +131,7 @@
 				[self sendToEngine:@"e$template_filter 1"];
 								
 				// theme info
-				[self sendToEngine:@"etheme Freeway"];
+				[self sendToEngine:@"etheme Compost"];
 				
 				// team 1 info
 				[self sendToEngine:@"eaddteam 4421353 System Cats"];
@@ -150,7 +151,8 @@
 				[self sendToEngine:@"ehat NoHat"];
 				
 				// team 1 ammostore
-				[self sendToEngine:@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144"];
+				[self sendToEngine:@"eammstore 20501090003040000009000000000000000000010404000441400444645644444774776112211144"];
+				//[self sendToEngine:@"eammstore 93919294221991210322351110012010000002110404000441400444645644444774776112211144"];
 
 				// team 2 info
 				[self sendToEngine:@"eaddteam 4100897 Poke-MAN"];
--- a/cocoaTouch/SDLOverrides/SDL_uikitview.m	Sun Jan 31 22:15:53 2010 +0000
+++ b/cocoaTouch/SDLOverrides/SDL_uikitview.m	Sun Jan 31 22:43:09 2010 +0000
@@ -76,6 +76,7 @@
 	menuButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 480, 30,50)];
 	[menuButton setBackgroundImage:[UIImage imageNamed:@"Default.png"] forState:UIControlStateNormal];
 	[menuButton addTarget:[self superclass] action:@selector(attackButtonPressed) forControlEvents:UIControlEventTouchUpInside];
+	[menuButton addTarget:[self superclass] action:@selector(attackButtonReleased) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside];
 	[self addSubview:menuButton];
 
 
@@ -92,12 +93,14 @@
 
 void IPH_showControls (void) {
 	NSLog(@"Showing controls");
-	/*[UIView beginAnimations:nil context:NULL];
+	/*
+	[UIView beginAnimations:nil context:NULL];
 	[UIView setAnimationDuration:0.5];
 	attackButton.frame = CGRectMake(30, 430, 260, 50);
 	menuButton.frame = CGRectMake(0, 430, 30, 50);
 	[UIView commitAnimations];
-*/}
+	*/
+}
 
 #pragma mark -
 #pragma mark Superclass methods
@@ -174,8 +177,8 @@
 			initialDistanceForPinching = 0;
 			switch ([touch tapCount]) {
 				case 1:
-					NSLog(@"x:%d y:%d",(int)gestureStartPoint.x,(int)gestureStartPoint.y);
-					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, (int)gestureStartPoint.y - 250, (int)gestureStartPoint.x);
+					SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
+							      (int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
 					HW_click();
 					break;
 				case 2:
@@ -243,9 +246,12 @@
 	switch ([touches count]) {
 		case 1:
 			currentPosition = [touch locationInView:self];
-			
+			// panning
+			SDL_WarpMouseInWindow([SDLUIKitDelegate sharedAppDelegate].window, 
+							(int)gestureStartPoint.y, 320 - (int)gestureStartPoint.x);
 			// remember that we have x and y inverted
-			CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
+			/* temporarily disabling hog movements for camera panning testing
+			 CGFloat vertDiff = gestureStartPoint.x - currentPosition.x;
 			CGFloat horizDiff = gestureStartPoint.y - currentPosition.y;
 			CGFloat deltaX = fabsf(vertDiff);
 			CGFloat deltaY = fabsf(horizDiff);
@@ -259,6 +265,7 @@
 				if (vertDiff < 0) HW_aimUp();
 				else HW_aimDown();
 			}
+			*/
 			break;
 		case 2:
 			twoTouches = [touches allObjects];
@@ -272,12 +279,10 @@
 			if (currentDistanceOfPinching < initialDistanceForPinching + kMinimumPinchDelta) {
 				NSLog(@"Outward pinch detected");
 				HW_zoomOut();
-			}
-			if (currentDistanceOfPinching > initialDistanceForPinching + kMinimumPinchDelta){
+			} else if (currentDistanceOfPinching > initialDistanceForPinching + kMinimumPinchDelta){
 				NSLog(@"Inward pinch detected");
 				HW_zoomIn();
-			}
-			
+			} 			
 			currentDistanceOfPinching = initialDistanceForPinching;
 			break;
 		default: