Cocos2d-Swift v3.x Sprite Builder : 在 iPad iPhone sd 图像被使用.-ipad 后缀被忽略 [英] Cocos2d-Swift v3.x Sprite Builder : In iPad iPhone sd images are used. -ipad suffix ignored

查看:19
本文介绍了Cocos2d-Swift v3.x Sprite Builder : 在 iPad iPhone sd 图像被使用.-ipad 后缀被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Code:

var bg = CCSprite(imageNamed:"Background.png") 

Images used in Resource:

Background-hd.png
Background-ipad.png
Background-ipadhd.png
Background-iphone5hd.png
Background.png

In all device Background.png(320x480) used, other images are ignored. How to fix this ?

Retina display is not enabled...How to enable retina display in v3 ?

Here is working sample code with this problem.

解决方案

I'm not really advanced user of SpriteBuilder but have some concerns about your issue.

As you are using Sprite Builder for starting the project, it configures your CCFileUtils to distinguish different devices' resources by looking at folders, not prefixes. In your app delegate you can see this line:

[CCBReader configureCCFileUtils];

going into this method you can see that search mode for file utils is set to CCFileUtilsSearchModeDirectory

sharedFileUtils.searchMode = CCFileUtilsSearchModeDirectory;

So you need to use Publish folders and copy your Background image to each of them with the same name (Background.png), but with different resolution for each device.

You don't need to use image suffixes in SpriteBuilder at all.

这篇关于Cocos2d-Swift v3.x Sprite Builder : 在 iPad iPhone sd 图像被使用.-ipad 后缀被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆