Reputation: 41
I have implemented below code in cocos2d for showing background image and this code is working fine except in Retina devices. Background images is not scaled or set properly. It is working fine on iPad 2 with IOS 6.0 but not on Retina iPad (3) 6.0 and Retina simulators. I have even tried samples from github and ray wonder -samples. All codes have same issues. Did anybody face same kind of issue ?
CCSprite *bg ;
bg = [CCSprite spriteWithFile:@"GameBGiPad1.png"];
bg.anchorPoint = CGPointZero;
[self addChild:bg z:-2];
I have included below lines to enable retina display and also added image with name "GameBGiPad1-hd.png" but it is showing black background on retina after adding below code:-
Also included below code in app delegate:-
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");
Both images are not part of sprite sheet but placed in images folder.
Upvotes: 1
Views: 892
Reputation: 22042
Cocos2d 1.0 : Not supports iPad retina display.
Cocos2d 2.0 : Use below naming convention.
For iPad retina you need to put image with extension -ipadhd.png
GameBG.png - For iPhone
GameBG-hd.png - For iPhone HD
GameBG-ipad.png - For iPad
GameBG-ipadhd.png - For iPad HD
GameBG-iphone5hd - For iPhone5
Upvotes: 2