Reputation: 22042
In Cocos2d 2.0, I used below code to disable retina for iPad.
if(!IS_IPAD) //In AppController.m
{
[director_ enableRetinaDisplay:YES];
}
Now AppDelegate not has these calls. How to disable retina for iPad only ?
Upvotes: 0
Views: 212
Reputation: 9079
You might want to explore this. I do the same because i want to run all devices from a single set of textures ... and my textures are very 'potent' on all devices, looks fine.
this setup creates a ScreenViewPort that is constant size on all devices , 568x384. All my 'full background' textures are at 1136x768 pixels, able to display all devices. This simplifies layout drastically, but there is a small price to pay. World(0,0) is not ScreenViewPort(0,0). For example, when running on a 4in iPhone (568x320), ScreenViewPort bottom-left is at 0,32 , on an iPad it is at 28,0 ...
Our mileage may vary with new display sizes for iPhone 6, i'll cross that river when i get myself some devices and can ascertain the 'workability' of this.
in 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];
and in CCFileUtils , a minor 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 :)
}
Upvotes: 1