Support for -HD files in Android like in iOS Retina mode?


#1

I am porting my iOS game to Android and have lots of “image.png” along with their “image-hd.png” Retina HD counterparts and the same for my tilemaps (I have one TMX file and two png’s for each).

I see the “-HD” “__suffixiPhoneRetinaDisplay” is added in “CCFileUtils.mm” and is not part of the Android build. Is there a method of enabling this in Android builds?


#2

I’ve been looking into this enableRetinaDisplay() “HD" image files and TMX HD support in general on V2 Cocos2d-X. Just a heads up for anyone else looking at converting the iOS game to Android along with their Retina support:
TMX Maps .
# I have TMX maps in my game, the TMX map is in SD res with a”map.png" and a “map-hd.png” file. In version 1 Cocos2d-x on iOS this worked fine (though I fixed the cocos2d-x v1 code a while ago for this, see http://www.cocos2d-x.org/boards/6/topics/2859?r=11129#message-11129]). Unfortunitely this bug or something like it is back in V2.
# My solution to this for now is to generate HD versions of my TMX files and when I load them in, divide my object coordinates by 2. I converted my TMX files with and app called HD2x off the App Store (it’s $2).

Android HD sets of graphics
So adding the “enableRetinaDisplay” function to Cocos2d-x Android looks like a fairly complex patch. I had a look and saw it needs the CCFileUtils.cpp function “const char* CCFileUtils::fullPathFromRelativePath” to make it similar to iOS where it checks for files with “~~HD" and returns their file path instead. My quick attempt at getting it working failed but I’m sure with a little more time that could be done, then people writing or porting to Android could easily have “image.png” and “image-hd.png” of their resources like on iOS.
Conclusion
Due to a deadline I’ve opted to just to load in my "~~HD” files myself when running on a high-res Android device and for my TMX maps I used that tool mentioned above to make double size versions and I’m loading them in by hand also (all I have to do is divide object coordinates by 2, everything else loads in fine).