What exactly is the available file suffixes for Cocos2D, used for multi resolution support?

时间秒杀一切 提交于 2019-12-13 17:16:29

问题


I've been searching around for a while, but it's been hard to find a definit list of available suffixes which you can use for multi resolution support, if there is any? That is, loading images in a dimension depending on what device you're on. Especially for the interface.

I know that the "-hd" suffix exists for ipad retina display support, but besides that it would also be nice if there is any suffix for regular iPad resolution as well as an iPhone suffix when the game is loaded on an iPhone.

I've tried using suffixes like "-ipad" and "-iphone", but they do not seem to be recognized.

Anyone have tips on how this can be achieved, if at all?


回答1:


You need to be using cocos2d v1.1 or v2.0. Then you can use these extensions on assets supported by cocos2d (images, tilemaps, bitmap fonts, particle effects):

  • -hd (iPhone/iPod Retina)
  • -ipad (iPad 1 & 2)
  • -ipadhd (iPad Retina)

The CCFileUtils class has methods that allow you to use different suffixes and enable/disable automatic fallback to the next lower resolution assets.

Earlier cocos2d versions support only -hd, with the -ipad suffix not supported in most versions because it was for a long time only available in a separate github branch. The -ipadhd suffix is fairly new, introduced in cocos2d v1.1 and v2.0.

At this time there is no special suffix for Mac Retina displays.



来源:https://stackoverflow.com/questions/12053485/what-exactly-is-the-available-file-suffixes-for-cocos2d-used-for-multi-resoluti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!