project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
changeset 6209 074ab6ebcb3e
parent 6084 e692c0348e74
child 6224 42b256eca362
child 6246 6b2d19ed521a
equal deleted inserted replaced
6208:b831679e9467 6209:074ab6ebcb3e
    62 }
    62 }
    63 
    63 
    64 // main routine for calling the actual game engine
    64 // main routine for calling the actual game engine
    65 -(void) engineLaunch {
    65 -(void) engineLaunch {
    66     const char *gameArgs[11];
    66     const char *gameArgs[11];
    67     NSInteger width, height;
    67     CGFloat width, height;
       
    68     CGFloat screenScale = [[UIScreen mainScreen] safeScale];
    68     NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", self.ipcPort];
    69     NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", self.ipcPort];
    69     NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]];
    70     NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]];
    70     NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
    71     NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
    71 
    72 
    72     if (IS_DUALHEAD()) {
    73     if (IS_DUALHEAD()) {
    73         CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds];
    74         CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds];
    74         width = (int) screenBounds.size.width;
    75         width = screenBounds.size.width;
    75         height = (int) screenBounds.size.height;
    76         height = screenBounds.size.height;
    76     } else {
    77     } else {
    77         CGRect screenBounds = [[UIScreen mainScreen] bounds];
    78         CGRect screenBounds = [[UIScreen mainScreen] bounds];
    78         width = (int) screenBounds.size.height;
    79         width = screenBounds.size.height;
    79         height = (int) screenBounds.size.width;
    80         height = screenBounds.size.width;
    80     }
    81     }
    81 
    82 
    82     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width * (int)[[UIScreen mainScreen] scale]];
    83     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)];
    83     NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", height * (int)[[UIScreen mainScreen] scale]];
    84     NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", (int)(height * screenScale)];
    84     NSString *rotation = [[NSString alloc] initWithString:@"0"];
    85     NSString *rotation = [[NSString alloc] initWithString:@"0"];
    85 
    86 
    86     NSString *modelId = [HWUtils modelType];
    87     NSString *modelId = [HWUtils modelType];
    87     NSInteger tmpQuality;
    88     NSInteger tmpQuality;
    88     if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"])     // = iPhone and iPhone 3G or iPod Touch or iPod Touch 2G
    89     if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"])     // = iPhone and iPhone 3G or iPod Touch or iPod Touch 2G