Support 4 inch cocos2d iphone 5 display

I searched everywhere for this, but no luck.

How to prepare my cocos2d-based game for the larger 4-inch iPhone 5 display? My application works, but I want to improve it for a larger 4-inch display. Cocos2d uses custom suffixes for retinal images. To display the retina iPhone 4 and 4S it image-hd.png. Is there a suffix for iPhone 5? How to do it?

Greetings.

+5
source share
9 answers

Add it to AppDelegate:

[CCFileUtils setiPadRetinaDisplaySuffix:@"your suffix"];
[CCFileUtils setiPadSuffix:@"your suffix"];
[CCFileUtils setiPhoneFourInchDisplaySuffix:@"your suffix"];
[CCFileUtils setiPhoneRetinaDisplaySuffix:@"your suffix"];
+8
source

iPhone 5, 176 (88 ) . Retina, cocos2d -hd.

- . - 44 " ", , .

Update: cocos2d 2.1 -widehd. , 2.1 , -iphone5hd.

-568hd, iPhone 5 . iPhone , .

+12

, , .

-568h iPhone5/iPod Touch 5th ( 4- ).

:

  • -hd (iPhone 4/4S, iPod Touch 4th)
  • -568h (iPhone 5, iPod Touch 5th)
  • -ipad (iPad 1st/2nd)
  • -ipadhd (iPad 3rd/4th)
+7

AppDelegate :

if((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) && ([[UIScreen mainScreen] bounds].size.height == 568)) {
    [sharedFileUtils setiPhoneRetinaDisplaySuffix: @"-your suffix"];
}
+7

, , cocos2d. , , . cocos2d 2.1 , , . , , iOS.

, . , ...

  • background.png 480x320 iPhone
  • background-hd.png 960x640 iPhone (3.5 ")
  • background-iphone5hd.png iPhone5 (4 ")

CCSprite. Cocos , .

CCSprite *background = [CCSprite spriteWithFile:@"background.png"];
background.position = ccp(background.textureRect.size.width/2,
background.textureRect.size.height/2);
[self addChild:background];

, , , cocos2d character-hd.png iPhone5. character-iphone5hd.png.

2.1 https://github.com/cocos2d/cocos2d-iphone/wiki/cocos2d-v2.1-release-notes

+2

cocos2d v2.1-beta4.

CCFileUtils.h :

- (void)setIphone5HDSuffix:(NSString *)suffix;

CCFileUtils.m:

- (void)setIphone5HDSuffix:(NSString *)suffix
{
   [_suffixesDict setObject:suffix forKey:kCCFileUtilsiPhone5HD];
}

AppDelegate.m:

[sharedFileUtils setIphone5HDSuffix:@"your_suffix"];

!

+2

, , Default-568h@2x.png 1136x640?

iPhone 5?

If this does not work, I found this post on the cocos2d forum containing a lot of information:

iPhone 5 1136 x 640 Screen Resolution: http://www.cocos2d-iphone.org/forum/topic/39491

+1
source

Cocos2d now also supports iPhone widescreen.

 -wide.png for iphone 5
 -widehd.png for iPhone 5 HD
0
source

I just played with suffixes in Cocos2D 2.1-rc1 and was able to force it to automatically download the iPhone5 file using the suffix "-iphone5hd" without changing anything in AppDelegate in the sharedFileUtil code section. Hope this helps too.

0
source

All Articles