Strange behavior getWinSize() on IOS simulator

Strange behavior getWinSize() on IOS simulator
0.0 0


Problem: getWinSize() function returns wrong size for retina device.

Tested by this code

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

    CCSize pointsSize = pDirector->getWinSize();
    CCLog("getWinSize w:%f h:%f",pointsSize.width,pointsSize.height);
    CCSize pSize = pDirector->getWinSizeInPixels();
    CCLog("getWinSizeInPixels w:%f h:%f",pSize.width,pSize.height);

Result for retina simulator:
Cocos2d: getWinSize w:640.000000 h:960.000000
Cocos2d: getWinSizeInPixels w:640.000000 h:960.000000

For iPad Retina Simulator and iPhone 4inch Simulator situation is the same.

Is it should be so? Or it is problem with simulator?
Can anyone check it on device (don’t have such possibility)?

Thanks in advance!

OS X 10.8.2
XCode 4.5


The winSize returns the value your design resolution size. If you didn’t set the design resolution, the design resolution is set to a default value(the same as window size).
So if you want to use the coordinates that fit for non-retina on your retina device, you should set the design resolution first.
Then, try to get the winSize, it will give you what you expect.


Thanks a lot