project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 5195 1bfa81f0bc21
parent 5177 b850b544addc
child 5206 db775bddf771
equal deleted inserted replaced
5194:851c6fbb44e6 5195:1bfa81f0bc21
    40 
    40 
    41 #pragma mark -
    41 #pragma mark -
    42 #pragma mark rotation
    42 #pragma mark rotation
    43 
    43 
    44 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    44 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    45     // don't rotate until the game is running for performance and synchronization with the sdlview
       
    46     if (isGameRunning() == NO)
       
    47         return (interfaceOrientation == (UIInterfaceOrientation) self.initialOrientation);
       
    48     return rotationManager(interfaceOrientation);
    45     return rotationManager(interfaceOrientation);
    49 }
    46 }
    50 
    47 
    51 // while in dual head the above rotation functions are not called
    48 // while in dual head the above rotation functions are not called
    52 -(void) handleRotationEvent:(NSNotification *)notification {
    49 -(void) handleRotationEvent:(NSNotification *)notification {
   115             break;
   112             break;
   116         case UIDeviceOrientationLandscapeRight:
   113         case UIDeviceOrientationLandscapeRight:
   117             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
   114             self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90));
   118             break;
   115             break;
   119         default:
   116         default:
   120             DLog(@"Nope");
       
   121             break;
   117             break;
   122     }
   118     }
   123     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
   119     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
   124     [[NSNotificationCenter defaultCenter] addObserver:self
   120     [[NSNotificationCenter defaultCenter] addObserver:self
   125                                              selector:@selector(handleRotationEvent:)
   121                                              selector:@selector(handleRotationEvent:)
   662                 }
   658                 }
   663             } else
   659             } else
   664                 initialDistanceForPinching = currentDistanceOfPinching;
   660                 initialDistanceForPinching = currentDistanceOfPinching;
   665             break;
   661             break;
   666         default:
   662         default:
   667             DLog(@"Nope");
       
   668             break;
   663             break;
   669     }
   664     }
   670 }
   665 }
   671 
   666 
   672 @end
   667 @end