# HG changeset patch # User koda # Date 1304221192 -7200 # Node ID 1bfa81f0bc21aff37903a0907a273d48a97e07eb # Parent 851c6fbb44e696499288bfe412bd6bff0ccdef55 fix rotation and ammomenu on ios diff -r 851c6fbb44e6 -r 1bfa81f0bc21 project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Sat Apr 30 20:06:05 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Sun May 01 05:39:52 2011 +0200 @@ -67,17 +67,17 @@ [self viewWillAppear:YES]; [container addSubview:self.view]; - if (placingPoint.x == -1 && placingPoint.y == -1) + if (placingPoint.x == -1 || placingPoint.y == -1) placingPoint = container.center; - if (IS_DUALHEAD() == NO) - self.view.center = CGPointMake(placingPoint.y, placingPoint.x); - else { + if (IS_DUALHEAD() == YES) { UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) self.view.center = CGPointMake(placingPoint.y, placingPoint.x); else self.view.center = CGPointMake(placingPoint.x, placingPoint.y); - } + } else + self.view.center = CGPointMake(placingPoint.y, placingPoint.x); + self.isVisible = YES; if (IS_IPAD() == NO) HW_pause(); @@ -116,7 +116,7 @@ [self.view addSubview:self.captionLabel]; [caption release]; - UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 415, 53)]; + UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, self.view.frame.size.height-50, 415, 53)]; description.backgroundColor = [UIColor clearColor]; description.textColor = [UIColor whiteColor]; description.text = DEFAULT_DESCRIPTION; @@ -281,7 +281,7 @@ if (theButton.tag > 41) y = 5; else - y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18; + y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*40; self.nameLabel.frame = CGRectMake(x, y, 200, 20); self.captionLabel.frame = CGRectMake(x+200, y, 220, 20); diff -r 851c6fbb44e6 -r 1bfa81f0bc21 project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Sat Apr 30 20:06:05 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Sun May 01 05:39:52 2011 +0200 @@ -57,10 +57,8 @@ #pragma mark - // overlay with controls, become visible later, with a transparency effect since the sdlwindow is not yet created -(void) displayOverlayLater:(id) object { - NSDictionary *dict = (NSDictionary *)object; - - [self.overlayController setUseClassicMenu:[[dict objectForKey:@"menu"] boolValue]]; - [self.overlayController setInitialOrientation:[[dict objectForKey:@"orientation"] intValue]]; + [self.overlayController setUseClassicMenu:[[self.systemSettings objectForKey:@"menu"] boolValue]]; + [self.overlayController setInitialOrientation:self.parentController.interfaceOrientation]; UIWindow *gameWindow = (IS_DUALHEAD() ? [HedgewarsAppDelegate sharedAppDelegate].uiwindow : [[UIApplication sharedApplication] keyWindow]); [gameWindow addSubview:self.overlayController.view]; @@ -155,12 +153,7 @@ blackView.alpha = 1; // prepare options for overlay and add it to the future sdl uiwindow - NSDictionary *overlayOptions = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithInt:self.parentController.interfaceOrientation],@"orientation", - [self.systemSettings objectForKey:@"menu"],@"menu", - nil]; - [self performSelector:@selector(displayOverlayLater:) withObject:overlayOptions afterDelay:3]; - [overlayOptions release]; + [self performSelector:@selector(displayOverlayLater:) withObject:nil afterDelay:3]; // SYSTEMS ARE GO!! [self startGameEngine]; diff -r 851c6fbb44e6 -r 1bfa81f0bc21 project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sat Apr 30 20:06:05 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Sun May 01 05:39:52 2011 +0200 @@ -42,9 +42,6 @@ #pragma mark rotation -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - // don't rotate until the game is running for performance and synchronization with the sdlview - if (isGameRunning() == NO) - return (interfaceOrientation == (UIInterfaceOrientation) self.initialOrientation); return rotationManager(interfaceOrientation); } @@ -117,7 +114,6 @@ self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); break; default: - DLog(@"Nope"); break; } [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; @@ -664,7 +660,6 @@ initialDistanceForPinching = currentDistanceOfPinching; break; default: - DLog(@"Nope"); break; } }