So there is two types of screen resolutions for the iPhone. The standard is 320x480 and devices with retina display is 640x960.
From Cocos2d v0.99.5 beta3 Points is added to the project, to make it easier to develop on multiple devices. If I understand it, than all coordinates are transformed into the dimension of the standard device. There are no need to add different positions, just use points like that, and it will work on all devices:
sprite.position = ccp(240,160);High resolution images is used automatically too. You say that you need sprite.png, and Cocos2d will see if retina display is enabled. If yes end there is a sprite-hd.png inside the resources than it will be used. The -hd suffix can be overwritten in the ccConfig.h file.
Finally to enable retina display, just paste this code to your app delegate:
[director setOpenGLView:glView];
if ([UIScreen instancesRespondToSelector:@selector(scale)]) {
[director setContentScaleFactor:[[UIScreen mainScreen] scale]];
}
For the article click here.
0 comments:
Post a Comment