# HG changeset patch # User koda # Date 1279661454 -7200 # Node ID 2378ada8a6ee395fadb34a7d2f54a74815bd9dab # Parent bc125bea5849f00afb54bd2b2b497fcba7273ece i can haz panning diff -r bc125bea5849 -r 2378ada8a6ee hedgewars/PascalExports.pas --- a/hedgewars/PascalExports.pas Tue Jul 20 05:37:58 2010 +0200 +++ b/hedgewars/PascalExports.pas Tue Jul 20 23:30:54 2010 +0200 @@ -164,6 +164,12 @@ CursorPoint.Y:= y; end; +procedure HW_getCursor(x,y: PLongInt); cdecl; export; +begin + x^:= CursorPoint.X; + y^:= CursorPoint.Y; +end; + procedure HW_saveCursor(reset: boolean); cdecl; export; begin if reset then diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/EditableCellView.m --- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Tue Jul 20 23:30:54 2010 +0200 @@ -9,8 +9,6 @@ #import "EditableCellView.h" #import "CommodityFunctions.h" -#define MAX_STRING_LENGTH 64 - @implementation EditableCellView @synthesize delegate, textField, oldValue; diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Tue Jul 20 23:30:54 2010 +0200 @@ -243,6 +243,8 @@ } -(void) didReceiveMemoryWarning { + if (activeController.view.superview == nil) + activeController = nil; // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. @@ -252,7 +254,6 @@ teamConfigViewController = nil; if (schemeWeaponConfigViewController.view.superview == nil) schemeWeaponConfigViewController = nil; - activeController = nil; MSG_MEMCLEAN(); } @@ -266,7 +267,7 @@ } -(void) dealloc { - [activeController release]; + //[activeController release]; [mapConfigViewController release]; [teamConfigViewController release]; [schemeWeaponConfigViewController release]; diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Tue Jul 20 23:30:54 2010 +0200 @@ -32,8 +32,6 @@ @property (nonatomic,retain) id popoverController; @property (nonatomic,retain) InGameMenuViewController *popupMenu; -BOOL isGameRunning; - -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; @@ -48,3 +46,6 @@ -(void) activateOverlay; @end + +BOOL isGameRunning; + diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Tue Jul 20 23:30:54 2010 +0200 @@ -413,10 +413,11 @@ [self activateOverlay]; doNotDim(); - } + } isSegmentVisible = !isSegmentVisible; - } - + } else + if (HW_isWeaponSwitch()) + HW_tab(); break; case 2: HW_allKeysUp(); @@ -447,6 +448,7 @@ -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { CGRect screen = [[UIScreen mainScreen] bounds]; NSSet *allTouches = [event allTouches]; + int x, y; UITouch *touch, *first, *second; @@ -455,14 +457,17 @@ touch = [[allTouches allObjects] objectAtIndex:0]; CGPoint currentPosition = [touch locationInView:self.view]; - if (HW_isAmmoOpen()) { + if (HW_isAmmoOpen() || HW_isWeaponRequiringClick()) { // moves the cursor around HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); } else { - DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y)); - HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); - if (HW_isWeaponSwitch()) - HW_tab(); + // panning \o/ + HW_getCursor(&x, &y); + x = x + currentPosition.x - startingPoint.x; + y = y + currentPosition.y - startingPoint.y; + HW_setCursor(x, y); + + startingPoint = currentPosition; } break; case 2: diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/PascalImports.h --- a/project_files/HedgewarsMobile/Classes/PascalImports.h Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Tue Jul 20 23:30:54 2010 +0200 @@ -54,6 +54,7 @@ void HW_setLandscape(BOOL rotate); void HW_setCursor(int x, int y); + void HW_getCursor(int *x, int *y); void HW_saveCursor(BOOL reset); BOOL HW_isAmmoOpen(void); diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Tue Jul 20 23:30:54 2010 +0200 @@ -140,10 +140,10 @@ } -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application { + print_free_memory(); if (self.mainViewController.view.superview == nil) self.mainViewController = nil; MSG_MEMCLEAN(); - print_free_memory(); } -(void) applicationWillResignActive:(UIApplication *)application { diff -r bc125bea5849 -r 2378ada8a6ee project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Jul 20 05:37:58 2010 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Jul 20 23:30:54 2010 +0200 @@ -1281,7 +1281,9 @@ GCC_DEBUGGING_SYMBOLS = default; GCC_FAST_MATH = YES; GCC_OPTIMIZATION_LEVEL = 2; + GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -1291,7 +1293,7 @@ "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; - ONLY_ACTIVE_ARCH = NO; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lz", "-Wl,-no_order_inits", @@ -1397,8 +1399,9 @@ VALGRIND_REXEC, DEBUG, ); + GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; - GCC_VERSION = 4.2; + GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -1408,7 +1411,7 @@ "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; - ONLY_ACTIVE_ARCH = NO; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lz", "-Wl,-no_order_inits", @@ -1598,7 +1601,9 @@ GCC_FAST_MATH = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -1608,7 +1613,7 @@ "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; - ONLY_ACTIVE_ARCH = NO; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lz", "-Wl,-no_order_inits", @@ -1638,7 +1643,9 @@ GCC_FAST_MATH = YES; GCC_OPTIMIZATION_LEVEL = 2; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_STRICT_ALIASING = YES; GCC_THUMB_SUPPORT = NO; + GCC_VERSION = ""; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( @@ -1648,7 +1655,7 @@ "\"$(SRCROOT)/../../../Library/SDL-1.3/SDL/include/\"", ); IPHONEOS_DEPLOYMENT_TARGET = 3.0; - ONLY_ACTIVE_ARCH = NO; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-lz", "-Wl,-no_order_inits",