Disable iPad Retina in Cocos2d v 3



在Cocos2d 2.0中,我使用以下代码禁用了iPad的retina。

     if(!IS_IPAD)   //In AppController.m
     {
        [director_ enableRetinaDisplay:YES];
     }

现在AppDelegate没有这些调用。如何禁用仅适用于iPad的视网膜?

您可能想探索一下。我这么做是因为我想从一组纹理运行所有设备。。。我的纹理在所有设备上都非常"强大",看起来很好。

此设置在所有设备上创建一个大小不变的ScreenViewPort,568x384。我所有的"全背景"纹理都是1136x768像素,能够显示所有设备。这大大简化了布局,但代价很小。World(0,0)不是ScreenViewPort(0,0。例如,在4英寸iPhone(568x320)上运行时,ScreenViewPort左下角为0,32,在iPad上为28,0。。。

我们的里程数可能会因iPhone 6的新显示屏尺寸而异,当我给自己买了一些设备后,我会跨过这条河,并确定它的"可操作性"。

在AppDelegate:中

NSString *kCCFileUtilsSuffixDefault = @"default";
NSString *kCCFileUtilsSuffixiPad = @"ipad";
NSString *kCCFileUtilsSuffixiPadHD = @"ipadhd";  
NSString *kCCFileUtilsSuffixiPhone = @"iphone";
NSString *kCCFileUtilsSuffixiPhoneHD = @"iphonehd";
NSString *kCCFileUtilsSuffixiPhone5 = @"iphone5";
NSString *kCCFileUtilsSuffixiPhone5HD = @"iphone5hd";
//NSString *kCCFileUtilsSuffixMac = @"mac";
//NSString *kCCFileUtilsSuffixMacHD = @"machd";
NSDictionary *dic = [CCFileUtils sharedFileUtils].suffixesDict;
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixDefault];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPhone];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPad];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPadHD];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPhoneHD];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPhone5];
[dic setValue:@"-hd" forKey:kCCFileUtilsSuffixiPhone5HD];
[self setupCocos2dWithOptions:@{
        // Show the FPS and draw call label.
        CCSetupShowDebugStats : @(YES),
        // More examples of options you might want to fiddle with:
        // (See CCAppDelegate.h for more information)
        // Use a 16 bit color buffer:
        // CCSetupPixelFormat: kEAGLColorFormatRGB565,
        // Use a simplified coordinate system that is shared across devices.
        CCSetupScreenMode : CCScreenModeFixed,
        // Run in landscape mode.
        CCSetupScreenOrientation : CCScreenOrientationLandscape,
        // Run at a reduced framerate.
        CCSetupAnimationInterval : @(1.0 / 30.0),
        // Run the fixed timestep extra fast.
        CCSetupFixedUpdateInterval : @(1.0 / 60.0),
        // Make iPad's act like they run at a 2x content scale. (iPad retina 4x)
       //       CCSetupTabletScale2X: @(YES),
}];
[CCTexture PVRImagesHavePremultipliedAlpha:YES];

在CCFileUtils中,一个次要的mod:)

-(CGFloat) contentScaleForKey:(NSString*)k inDictionary:(NSDictionary *)dictionary{
    // XXX XXX Super Slow
    // ylb fix for single set of textures
    return 2.0f;
    // ylb fix : super fast now :)
}

最新更新