# HG changeset patch # User koda # Date 1278548590 -7200 # Node ID 86212d2b116a187c8a794d6131292900811de62e # Parent 2b4d878ba565aa7b61661e03ec7cb2ef06f842a9 redo spinning wheel, redo fix for detail selection, redo ammo quantity and name in ammomenu diff -r 2b4d878ba565 -r 86212d2b116a CMakeLists.txt --- a/CMakeLists.txt Wed Jul 07 03:16:12 2010 +0200 +++ b/CMakeLists.txt Thu Jul 08 02:23:10 2010 +0200 @@ -159,7 +159,7 @@ set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Si" ${pascal_compiler_flags_cmn}) set(haskell_compiler_flags_cmn "-O2" "-w") else(Optz) - set(pascal_compiler_flags_cmn "-O-" "-ghl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn}) + set(pascal_compiler_flags_cmn "-O-" "-g" "-gh" "-gl" "-dDEBUGFILE" ${pascal_compiler_flags_cmn}) set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint") endif(Optz) diff -r 2b4d878ba565 -r 86212d2b116a hedgewars/uStore.pas --- a/hedgewars/uStore.pas Wed Jul 07 03:16:12 2010 +0200 +++ b/hedgewars/uStore.pas Thu Jul 08 02:23:10 2010 +0200 @@ -1265,6 +1265,10 @@ end; //////////////////////////////////////////////////////////////////////////////// +{$IFDEF IPHONEOS} +procedure startSpinning; cdecl; external; +procedure stopSpinning; cdecl; external; +{$ENDIF} procedure AddProgress; var r: TSDL_Rect; texsurf: PSDL_Surface; @@ -1279,6 +1283,9 @@ squaresize:= texsurf^.w shr 1; numsquares:= texsurf^.h div squaresize; SDL_FreeSurface(texsurf); +{$IFDEF IPHONEOS} + startSpinning(); +{$ENDIF} end; TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); @@ -1301,15 +1308,12 @@ end; -{$IFDEF IPHONEOS} -procedure spinningWheelDone; cdecl; external; -{$ENDIF} procedure FinishProgress; begin WriteLnToConsole('Freeing progress surface... '); FreeTexture(ProgrTex); {$IFDEF IPHONEOS} - spinningWheelDone(); + stopSpinning(); {$ENDIF} end; diff -r 2b4d878ba565 -r 86212d2b116a hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Wed Jul 07 03:16:12 2010 +0200 +++ b/hedgewars/uWorld.pas Thu Jul 08 02:23:10 2010 +0200 @@ -355,12 +355,17 @@ RenderWeaponTooltip(amSel) end; - {$IFNDEF IPHONEOS} +{$IFDEF IPHONEOS} + DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); + + if Ammo^[Slot, Pos].Count < AMMO_INFINITE then + DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); +{$ELSE} DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); if Ammo^[Slot, Pos].Count < AMMO_INFINITE then DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); - {$ENDIF} +{$ENDIF} if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then begin diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Jul 08 02:23:10 2010 +0200 @@ -155,12 +155,16 @@ nil]; // finally launch game and remove this controller + DLog(@"sending config %@", gameDictionary); + [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary]; [gameDictionary release]; //[[self parentViewController] dismissModalViewControllerAnimated:YES]; } -(void) viewDidLoad { + self.view.backgroundColor = [UIColor blackColor]; + CGRect screen = [[UIScreen mainScreen] bounds]; self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); @@ -185,8 +189,9 @@ } else { // this is the visible controller mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - // this must be loaded to auto set default scheme and ammo + // this must be loaded & added to auto set default scheme and ammo schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; + [self.view addSubview:schemeWeaponConfigViewController.view]; } activeController = mapConfigViewController; diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Classes/OverlayViewController.h --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h Thu Jul 08 02:23:10 2010 +0200 @@ -19,19 +19,13 @@ PopoverMenuViewController *popupMenu; BOOL isPopoverVisible; - UITextField *writeChatTextField; - CGFloat initialDistanceForPinching; - UIActivityIndicatorView *spinningWheel; } @property (nonatomic,retain) id popoverController; @property (nonatomic,retain) PopoverMenuViewController *popupMenu; -@property (nonatomic,retain) UITextField *writeChatTextField; -@property (nonatomic,retain) IBOutlet UIActivityIndicatorView *spinningWheel; -UIActivityIndicatorView *singleton; -BOOL canDim; +BOOL isGameRunning; -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Thu Jul 08 02:23:10 2010 +0200 @@ -20,7 +20,7 @@ @implementation OverlayViewController -@synthesize popoverController, popupMenu, writeChatTextField, spinningWheel; +@synthesize popoverController, popupMenu; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { return rotationManager(interfaceOrientation); @@ -107,8 +107,6 @@ #pragma mark View Management -(void) viewDidLoad { isPopoverVisible = NO; - singleton = self.spinningWheel; - canDim = NO; self.view.alpha = 0; self.view.center = CGPointMake(self.view.frame.size.height/2.0, self.view.frame.size.width/2.0); @@ -152,12 +150,9 @@ /* these are causing problems at reloading so let's remove 'em -(void) viewDidUnload { - [popoverController dismissPopoverAnimated:NO]; [dimTimer invalidate]; - self.writeChatTextField = nil; self.popoverController = nil; self.popupMenu = nil; - self.spinningWheel = nil; [super viewDidUnload]; MSG_DIDUNLOAD(); } @@ -173,11 +168,9 @@ */ -(void) dealloc { - [writeChatTextField release]; [popupMenu release]; [popoverController release]; // dimTimer is autoreleased - [spinningWheel release]; [super dealloc]; } @@ -185,7 +178,7 @@ #pragma mark Overlay actions and members // nice transition for dimming, should be called only by the timer himself -(void) dimOverlay { - if (canDim) { + if (isGameRunning) { [UIView beginAnimations:@"overlay dim" context:NULL]; [UIView setAnimationDuration:0.6]; self.view.alpha = 0.2; @@ -201,6 +194,9 @@ // dim the overlay when there's no more input for a certain amount of time -(IBAction) buttonReleased:(id) sender { + if (!isGameRunning) + return; + UIButton *theButton = (UIButton *)sender; switch (theButton.tag) { @@ -229,6 +225,10 @@ if (isPopoverVisible) { [self dismissPopover]; } + + if (!isGameRunning) + return; + UIButton *theButton = (UIButton *)sender; switch (theButton.tag) { @@ -333,12 +333,6 @@ [sender resignFirstResponder]; } -// this function is called by pascal FinishProgress and removes the spinning wheel when loading is done -void spinningWheelDone (void) { - [singleton stopAnimating]; - singleton = nil; - canDim = YES; -} #pragma mark - #pragma mark Custom touch event handling @@ -351,12 +345,14 @@ if (isPopoverVisible) { [self dismissPopover]; } + /* if (writeChatTextField) { [self.writeChatTextField resignFirstResponder]; [dimTimer setFireDate:HIDING_TIME_DEFAULT]; } - - if (currentPosition.y < screen.size.width - 120) { + */ + + if (currentPosition.y < screen.size.width - 130 || (currentPosition.x > 130 && currentPosition.x < screen.size.height - 130)) { switch ([touches count]) { case 1: DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y)); @@ -428,5 +424,23 @@ } } +// called from AddProgress and FinishProgress (respectively) +void startSpinning() { + isGameRunning = NO; + CGRect screen = [[UIScreen mainScreen] bounds]; + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + indicator.tag = 987654; + indicator.center = CGPointMake(screen.size.width/2 - 118, screen.size.height/2); + indicator.hidesWhenStopped = YES; + [indicator startAnimating]; + [[[[UIApplication sharedApplication] keyWindow] viewWithTag:12345] addSubview:indicator]; + [indicator release]; +} + +void stopSpinning() { + UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[[[[UIApplication sharedApplication] keyWindow] viewWithTag:12345] viewWithTag:987654]; + [indicator stopAnimating]; + isGameRunning = YES; +} @end diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Thu Jul 08 02:23:10 2010 +0200 @@ -100,7 +100,9 @@ // bring the uiwindow below in front //UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0]; //[aWin makeKeyAndVisible]; - //DLog(@"%@",[[UIApplication sharedApplication] windows]); + + // notice that in the simulator this reports 2 windows + DLog(@"%@",[[UIApplication sharedApplication] windows]); [UIView beginAnimations:@"inserting main controller" context:NULL]; [UIView setAnimationDuration:1]; diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Jul 08 02:23:10 2010 +0200 @@ -1373,7 +1373,7 @@ FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; - FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -gl -gw2 -gs -gt -ghttt -Xs-"; + FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -g -gl -gw2 -gt -ghttt -Xs-"; FPC_UNITS_PATH = "-Fu\"$(PROJECT_DIR)\""; GCC_C_LANGUAGE_STANDARD = c99; GCC_DEBUGGING_SYMBOLS = full; @@ -1577,7 +1577,7 @@ FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; - FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -gl -gw2 -gt -ghttt -Xs-"; + FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -g -gl -gw2 -gt -ghttt -Xs-"; FPC_UNITS_PATH = "-Fu\"$(PROJECT_DIR)\""; GCC_C_LANGUAGE_STANDARD = c99; GCC_DEBUGGING_SYMBOLS = full; diff -r 2b4d878ba565 -r 86212d2b116a project_files/HedgewarsMobile/Resources/OverlayViewController.xib --- a/project_files/HedgewarsMobile/Resources/OverlayViewController.xib Wed Jul 07 03:16:12 2010 +0200 +++ b/project_files/HedgewarsMobile/Resources/OverlayViewController.xib Thu Jul 08 02:23:10 2010 +0200 @@ -242,16 +242,6 @@ menuCorner.png - - - 269 - {{225, 248}, {37, 37}} - - NO - IBCocoaTouchFramework - YES - 0 - 289 @@ -565,14 +555,6 @@ 60 - - spinningWheel - - - - 64 - - buttonPressed: @@ -606,7 +588,6 @@ YES - @@ -677,11 +658,6 @@ - 63 - - - - 67 @@ -704,7 +680,6 @@ 48.IBPluginDependency 53.IBPluginDependency 58.IBPluginDependency - 63.IBPluginDependency 67.IBPluginDependency @@ -722,7 +697,6 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -781,17 +755,6 @@ - - spinningWheel - UIActivityIndicatorView - - - spinningWheel - - spinningWheel - UIActivityIndicatorView - - IBProjectSource Classes/OverlayViewController.h @@ -934,14 +897,6 @@ - UIActivityIndicatorView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIActivityIndicatorView.h - - - UIButton UIControl