project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 3627 f1da1d8fb56c
parent 3626 19f78afa0188
child 3628 2b4d878ba565
equal deleted inserted replaced
3626:19f78afa0188 3627:f1da1d8fb56c
   110     singleton = self.spinningWheel;
   110     singleton = self.spinningWheel;
   111     canDim = NO;
   111     canDim = NO;
   112     self.view.alpha = 0;
   112     self.view.alpha = 0;
   113     self.view.center = CGPointMake(self.view.frame.size.height/2.0, self.view.frame.size.width/2.0);
   113     self.view.center = CGPointMake(self.view.frame.size.height/2.0, self.view.frame.size.width/2.0);
   114     
   114     
       
   115     // set initial orientation
       
   116     ///[self didRotate:[NSNotification notificationWithName:UIDeviceOrientationDidChangeNotification object:nil]];
       
   117     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
       
   118     UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:12345];
       
   119     switch (orientation) {
       
   120         case UIDeviceOrientationLandscapeLeft:
       
   121             sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(0));
       
   122             self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
       
   123             break;
       
   124         case UIDeviceOrientationLandscapeRight:
       
   125             sdlView.transform = CGAffineTransformMakeRotation(degreesToRadian(180));
       
   126             self.view.transform = CGAffineTransformMakeRotation(degreesToRadian(-90));
       
   127             break;
       
   128     }
       
   129     CGRect rect = [[UIScreen mainScreen] bounds];
       
   130     self.view.frame = CGRectMake(0, 0, rect.size.width, rect.size.height);
   115     
   131     
   116     dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6]
   132     dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6]
   117                                         interval:1000
   133                                         interval:1000
   118                                           target:self
   134                                           target:self
   119                                         selector:@selector(dimOverlay)
   135                                         selector:@selector(dimOverlay)
   131 
   147 
   132     [UIView beginAnimations:@"showing overlay" context:NULL];
   148     [UIView beginAnimations:@"showing overlay" context:NULL];
   133     [UIView setAnimationDuration:1];
   149     [UIView setAnimationDuration:1];
   134     self.view.alpha = 1;
   150     self.view.alpha = 1;
   135     [UIView commitAnimations];
   151     [UIView commitAnimations];
   136 
       
   137     // set initial orientation
       
   138     [self didRotate:[NSNotification notificationWithName:UIDeviceOrientationDidChangeNotification object:nil]];
       
   139 }
   152 }
   140 
   153 
   141 /* these are causing problems at reloading so let's remove 'em
   154 /* these are causing problems at reloading so let's remove 'em
   142 -(void) viewDidUnload {
   155 -(void) viewDidUnload {
   143     [popoverController dismissPopoverAnimated:NO];
   156     [popoverController dismissPopoverAnimated:NO];