It would be good to have some code to check if the current device has the retina display enabled. It’s an interesting feature since if we, for example, download a profile picture from facebook (or any picture from the internet), you might be interested on scaling the picture depending on if Retina is enabled or not.
Your “profile picture” will be scaled correctly anyway as Cocos2D works in points, not pixels.
If for some reason you do want to check if enableRetina is set, call CCDirector::getContentScaleFactor()" which should be 2 if running on a retina device, or 1 for SD.
The functions CCEGLView::isRetinaEnabled() and CCEGLView::enableRetinaDisplay() seem to have disappeared in the latest version (cocos2d-2.1beta3-x-2.1.0). Could you please advise on what the equivalent functions are now? Thank you for your help.
Looks like it’s been depreciated, probably because it was iOS specific, says use ContentScaleFactor now, see here: http://www.cocos2d-x.org/issues/1486
As for enabling it I’m not sure, I’ve not looked at this version yet.
Looks like it’s been depreciated, probably because it was iOS specific, says use ContentScaleFactor now, see here: http://www.cocos2d-x.org/issues/1486
>
As for enabling it I’m not sure, I’ve not looked at this version yet.
Good find, thank you. It makes a lot of sense to make everything use ContentScaleFactor. I’ve decided to stay with version 2.0.3 for now to avoid any potential confusions with this kind of thing. I’ve found that it’s quite difficult to make multi-resolution support work nicely with CCBReader, and retina on top was more fiddling still. Like you, I think I’ll pick this up again when I’ve got a little more time to mess around with it all…