Hacker Newsnew | comments | show | ask | jobs | submit login

I disagree with a few tips here. Rather than code to exact resolutions (eg: `if ([CCDirector sharedDirector].winSize.width == 568)`) build your games to be adaptive to the screen. That way when a new device is released you don't end up going through and making your code swiss cheese.

A better idea is to maybe make decisions when a size is greater than a certain amount, but still layout to relative amounts to the screen. This will make it easier to support landscape and portrait on 4/3 devices as well and not just 3/2 and 16/9 screens. Perhaps add additional HUD when you have the space.

Better yet, setup your simulator for several different sizes, and every now and then make sure everything still fits: http://0xced.blogspot.com/2012/08/prepare-your-apps-for-new-...

Later come talk to us at Apportable (YC2011 http://apportable.com/ ) and you can use our SDK to have your Cocos2D game run natively on hundreds of different resolutions and DPIs on Android.




To be fair, the author does suggest adaptive strategies all over the article. In practice, it's not uncommon to mix adaptive for the general case together with special cases optimized for a few specific, common and popular resolutions.

-----


sure, I don't mind mixing, but I don't vote for checking for exact resolutions, but rather ranges of resolution ratios. Instead of checking for "width == 586" check for width/height and checking to seeing if it's close to 16/9 or 3/2 or 4/3 and then using specific UI for those cases, but still keep the layout relative.

-----


Agreed. That was just a quick hack for detecting that a device is an iPhone 5.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: