getFrameSize() get wrong screen size.

getFrameSize() get wrong screen size.
0.0 0


I downloaded the newest cocos2d-x version(2.1), and want to get the screen size from
I started from iphone 4-inch simulator, the frame size should be
1136 * 640.

But getFrameSize() return 960 * 640.
(I didn’t call any setDesignResolutionSize() method. And seems the size of glView is 960 * 640).

Any idea?
Thanks in advance.

スクリーンショット 2013-06-21 11.18.39.png (321.2 KB)

bool AppDelegate::applicationDidFinishLaunching()
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();

    CCSize frameSize = CCEGLView::sharedOpenGLView()->getFrameSize();
    CCLOG("framesize : %f, %f", frameSize.width, frameSize.height);   

I print the frame size in applicationDidFinishLaunching function.
The result is :
Cocos2d: framesize : 960.000000, 640.000000
That is really weird.


Sounds like you are missing a “Default-568h@2x.png” image file, iOS expects to see it to know you support the 4" screen ratio. Copy the one out of the testCPP sample.

And I think you’ll find the output will then be “Cocos2d: framesize : 320.000000, 568.000000”.


thats right, please refer to here


That is right It worked.
Thank you, Gav GMTDev and Hao Wu.

But I am still surprised that there is no default “Default-568h@2x.png” image in the template of cocos2d-x.

Thank you very much.