iphone5 enable


#1

Hello,

Hello I want to enable the iphone5 resolution.

This post here: http://www.cocos2d-x.org/boards/6/topics/15980

Tells me I need to set ResolutionPolicy with CCEGLView::sharedOpenGLView()->setDesignResolutionSize().

However this method requires me to pass in the width and height manually. I want cocos2dx to report the correct resolution automatically but all of the following methods incorrectly report 640x960 when I run the program on my iphone5:

CCDirector::sharedDirector()->getWinSize()
CCDirector::sharedDirector()->getWinSizeInPixels()
CCEGLView::sharedOpenGLView()->getDesignResolutionSize()
CCDirector::sharedDirector()->getVisibleSize()

How do I get the above methods to report the correct resolution?
How do I enable iphone5 resolution in cocos2dx?

I want to be able to determine which resource directory to use (with CCFileUtils::sharedFileUtils()->setResourceDirectory()) by evaluating the resolution reported by cocos2dx. But as it reports the wrong resolution I can’t do this.


#2

OK, it appears in 2.1.4 you no longer use CCFileUtils::sharedFileUtils()->setResourceDirectory(): http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources

I still want to know how to get the iphone5 resolution working though. Please help.

Thanks


#3

OK I found the solution!

Here: http://www.cocos2d-x.org/boards/6/topics/16227

You just need to set the launch images “Default@2x.png” and “Default-568h@2x.png”.

Then it works automatically without any need to write code.

I assume this is beyond cocos2dx’s control… but it would be nice to have this solution be more available in search results.