-1

I have two questions...

  • How in Cocos2D 2.1 I define iPhone5 custom suffix? There is no new method for it.
  • Looking at docs I see suffixesDict which is mentioning iPhone5 and iPhone5 HD. What is the point to have iPhone5 suffix if it's always HD anyway?
Pablo
  • 28,133
  • 34
  • 125
  • 215

2 Answers2

2

You will have to modify the suffixesDict NSMutableDictionary directly to change the widescreen suffix. Follow the example of the setiPadSuffix method.

The default is "-widehd" and it used to be "-iphone5hd" in v2.1 rc and betas.

Don't ask why there's a non-HD suffix "-wide" - I can't think of a single way why one would want to use that, and there's no widescreen device that doesn't have a Retina display. It may simply exist due to internal code otherwise breaking as the code used to always check "HD" and then fall back to the "SD" variant of the same category. That's the only way I can explain why it exists.

Furthermore the "-widehd" suffix in itself should be rarely needed if an app is well designed with widescreen in mind. For example you could simply use the same widescreen background image on non-widescreen devices, and allow the image to be cut off on non-widescreen devices.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • so you mean I can have only `-hd`, which has iPhone5 resolution, then align elements based on device? – Pablo Jul 26 '13 at 08:45
  • 1
    yes, and if you design cleverly (ie position relative to corner rather than fixed coords per device) you don't eben have to change code or add conditional branches – CodeSmile Jul 26 '13 at 10:44
0

CCFileUtils has the option to search resources in folders without using Suffix, and it's more clean than the suffix. To do that change the search mode from suffix to directory by using the following code:

CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setSearchMode:kCCFileUtilsSearchDirectoryMode];

Then, create at least one of the following folders:

resources-iphone5hd (for iPhone 5 retina resources )
resources-iphone5 (for iPhone 5 non-retina resources )
resources-iphonehd (for iPhone retina resources )
resources-iphone (for iPhone non-retina resources )
resources-ipadhd (for iPad retina resources )
resources-ipad (for iPad non-retina resources )
resources-mac (for OS X resources)
resources-machd (for OS X retina resources. N/A yet)
Ziad Tamim
  • 350
  • 6
  • 17