project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 5177 b850b544addc
parent 5175 a3da220dbb3f
child 5195 1bfa81f0bc21
equal deleted inserted replaced
5176:b9539115608d 5177:b850b544addc
    24 #import "HelpPageViewController.h"
    24 #import "HelpPageViewController.h"
    25 #import "AmmoMenuViewController.h"
    25 #import "AmmoMenuViewController.h"
    26 #import "PascalImports.h"
    26 #import "PascalImports.h"
    27 #import "CommodityFunctions.h"
    27 #import "CommodityFunctions.h"
    28 #import "CGPointUtils.h"
    28 #import "CGPointUtils.h"
    29 #import "SDL_config_iphoneos.h"
       
    30 #import "SDL_mouse.h"
       
    31 #import "ObjcExports.h"
    29 #import "ObjcExports.h"
    32 
    30 
    33 #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7]
    31 #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7]
    34 #define HIDING_TIME_NEVER   [NSDate dateWithTimeIntervalSinceNow:10000]
    32 #define HIDING_TIME_NEVER   [NSDate dateWithTimeIntervalSinceNow:10000]
    35 #define doDim()             [dimTimer setFireDate: (IS_DUALHEAD()) ? HIDING_TIME_NEVER : HIDING_TIME_DEFAULT]
    33 #define doDim()             [dimTimer setFireDate: (IS_DUALHEAD()) ? HIDING_TIME_NEVER : HIDING_TIME_DEFAULT]
    53 // while in dual head the above rotation functions are not called
    51 // while in dual head the above rotation functions are not called
    54 -(void) handleRotationEvent:(NSNotification *)notification {
    52 -(void) handleRotationEvent:(NSNotification *)notification {
    55     if (isGameRunning() == NO)
    53     if (isGameRunning() == NO)
    56         return;
    54         return;
    57 
    55 
       
    56     UIView *sdlView = nil;
       
    57     for (UIView *oneView in [[[UIApplication sharedApplication] keyWindow] subviews])
       
    58         if ([oneView isMemberOfClass:[SDL_uikitopenglview class]]) {
       
    59             sdlView = (UIView *)oneView;
       
    60             break;
       
    61         }
       
    62 
    58     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    63     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    59     UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
       
    60     NSInteger angle_left = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 180 : 0;
    64     NSInteger angle_left = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 180 : 0;
    61     NSInteger angle_right = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 0 : 180;
    65     NSInteger angle_right = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 0 : 180;
    62 
    66 
    63     if (IS_VERY_POWERFUL()) {
    67     if (IS_VERY_POWERFUL()) {
    64         [UIView beginAnimations:@"overlay rotation" context:NULL];
    68         [UIView beginAnimations:@"overlay rotation" context:NULL];