Hi res images for cocos-2d sample loader
Hi res images for cocos-2d sample loader
I'm trying to load the cocos-2d demo onto a retina display iPad 4. It only shows a black screen, I think this is because there are no hi res images. Does anyone know a way to force Xcode to compile the app to load the low res images on a retina display?Maybe you can't do this. If iforce/Chris could create some images that would be great too.
Re: Hi res images for cocos-2d sample loader
That's strange. Are there any message in the debug output about images not being found? Is this on the actual device?
I have tested with physical devices for these screen types: 480x320, 960x640, 1024x768
... and with the simulators for 1136x640 and 2048x1536, and they all loaded and displayed ok.
Not sure what the problem could be here, I was not aware that 'hi-res' images are required... what constitutes a 'hi-res' image exactly?
I have tested with physical devices for these screen types: 480x320, 960x640, 1024x768
... and with the simulators for 1136x640 and 2048x1536, and they all loaded and displayed ok.
Not sure what the problem could be here, I was not aware that 'hi-res' images are required... what constitutes a 'hi-res' image exactly?
Re: Hi res images for cocos-2d sample loader
I think it is HD pictures
Re: Hi res images for cocos-2d sample loader
Yeah I mean the HD images. You have to add HD images for retina devices. HD images are double the pixel density of standard images. I'm not used to Xcode/iOS so I don't know a lot about it. I've never tested on a retina device before so I'm just assuming not having the HD images is what is causing the problem. I could be wrong though. Everything works fine in the simulator.
Re: Hi res images for cocos-2d sample loader
> Are there any message in the debug output about images not being found?
Is it just images? Can you see the debug draw display? Does anything show if you zoom right out?
Is it just images? Can you see the debug draw display? Does anything show if you zoom right out?
Re: Hi res images for cocos-2d sample loader
Hi, if I change this line in AppDelegate
if( ! [director enableRetinaDisplay:YES] )
to
if( ! [director enableRetinaDisplay:NO] )
then the images load fine. I'm also getting these kind of warnings about the HD files;
Warning HD file not found: planetcute-instructions3-hd.png
So I think it's just missing some HD images. Nice work on RUBE by the way, clever stuff.
if( ! [director enableRetinaDisplay:YES] )
to
if( ! [director enableRetinaDisplay:NO] )
then the images load fine. I'm also getting these kind of warnings about the HD files;
Warning HD file not found: planetcute-instructions3-hd.png
So I think it's just missing some HD images. Nice work on RUBE by the way, clever stuff.
Re: Hi res images for cocos-2d sample loader
That's really strange because when I run it on my retina device (iphone4), it fails to find the HD images, and then falls back to using the regular ones. I checked the Cocos2d source code, and this is the expected behavior of the getDoubleResolutionImage method of CCFileUtils.
fwiw I am also seeing that output in my debug panel:
=============
Off topic, but while I was checking the Cocos2d source code I found these things I feel like griping about...
- getDoubleResolutionImage is used to change the path name of files that are not even images! This is probably why you are seeing an empty screen, because even the .json file is expected to be "-hd.json". Seems like a bug? Or at least a bad name for this method...
- you cannot have the string "-hd" in the image name itself because getDoubleResolutionImage looks for this string and if it exists, it just returns the same string you passed in because it thinks the string is already an HD image name, without checking that the "-hd" substring is at the end of the filename or not. imho this is really bad... it's just lucky that the typical "-hd" string used here is lower case and has a non hexadecimal letter (h) in it, because the path for apps installed in the simulator contains a unique folder name like "A6DA-FCED1B8-..." etc. For example if you use the suffix "-2D" for your hi-res images, you could one day find your images mysteriously failing to be found when running on the simulator, even without changing any of the code whatsoever.
- if retina support is not #defined, the function getDoubleResolutionImage does nothing at all. This seems to me bad design because it belies the function name. Better to use the #define to just not call getDoubleResolutionImage in the first place (in fullPathFromRelativePath).
</rant>
fwiw I am also seeing that output in my debug panel:
Code: Select all
cocos2d: CCFileUtils: Warning HD file not found: images-hd.json
Full path is: /var/mobile/Applications/9043F2D6-64EA-422E-A6DA-FCED1B8DA7BD/RUBECocos2d.app/images.json
Loaded JSON ok
Loading image: images/tire.png
cocos2d: CCFileUtils: Warning HD file not found: tire-hd.png
Loading image: images/crate.png
cocos2d: CCFileUtils: Warning HD file not found: crate-hd.png
Loading image: images/truck.png
cocos2d: CCFileUtils: Warning HD file not found: truck-hd.png
Loading image: images/crate.png
Loading image: images/crate.png
Loading image: images/crate.png
Loading image: images/tire.png
Loading image: images/crate.png
Loading image: images/mcclory.png
cocos2d: CCFileUtils: Warning HD file not found: mcclory-hd.png
Loading image: images/crate.png
Off topic, but while I was checking the Cocos2d source code I found these things I feel like griping about...
- getDoubleResolutionImage is used to change the path name of files that are not even images! This is probably why you are seeing an empty screen, because even the .json file is expected to be "-hd.json". Seems like a bug? Or at least a bad name for this method...
- you cannot have the string "-hd" in the image name itself because getDoubleResolutionImage looks for this string and if it exists, it just returns the same string you passed in because it thinks the string is already an HD image name, without checking that the "-hd" substring is at the end of the filename or not. imho this is really bad... it's just lucky that the typical "-hd" string used here is lower case and has a non hexadecimal letter (h) in it, because the path for apps installed in the simulator contains a unique folder name like "A6DA-FCED1B8-..." etc. For example if you use the suffix "-2D" for your hi-res images, you could one day find your images mysteriously failing to be found when running on the simulator, even without changing any of the code whatsoever.
- if retina support is not #defined, the function getDoubleResolutionImage does nothing at all. This seems to me bad design because it belies the function name. Better to use the #define to just not call getDoubleResolutionImage in the first place (in fullPathFromRelativePath).
</rant>