cocos2d视网膜支持不再起作用 [英] cocos2d retina support not working anymore

查看:87
本文介绍了cocos2d视网膜支持不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的支持视网膜显示的cocos2d游戏出现问题.一切正常,但现在我正在进行更新.在此更新中,我仅添加了3个新图像(也以高清格式).我正在使用由zwoptex制成的纹理图集.生成的png是gameart.png和gameart-hd.png.我正在使用以下代码加载文件:

I am having a problem with my cocos2d game that supports retina display. Everything used to work fine but now i am working on an update. In this update i have only added 3 new images (also in hd). I am using texture atlases made with zwoptex. the png's generated are gameart.png and gameart-hd.png. I am loading the files using this code:

 CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
    [frameCache addSpriteFramesWithFile:@"gameart.plist"];

当我使用spriteWithFrameName:方法获取任何精灵时.以前一切正常(即使在iPhone 4上也可以),但现在我仅在iPhone 4上遇到以下错误:

when getting any sprite i am using spriteWithFrameName: method. Everything used to work fine before (Even on iPhone 4) but now i am getting the following error only on iPhone 4:

cocos2d: CCSpriteFrameCache: Frame 'tilei.png' not found
*** Assertion failure in -[BoardTile initWithSpriteFrame:]

文件tilei在gameart.png和gameart-hd.png(tilei.png和tilei-hd.png)以及plist文件中均可用.我再次检查了一千遍.可能出什么问题了?请注意,即使仅在iPhone 4上运行时,该错误也没有显示-hd后缀.

the file tilei is available in both gameart.png and gameart-hd.png (tilei.png and tilei-hd.png) and the plist files. i rechecked it a thousand times. what could be going wrong? notice that the error is not showing the -hd suffix even though its only occurring while running on iPhone 4.

推荐答案

对于hd精灵表中的 精灵,您不需要-hd的后缀.

You don't need the suffix of -hd for the sprites inside the hd spritesheet.

您似乎拥有:

  • sd-spritesheet
    • image1.png
    • image2.png
  • sd-spritesheet
    • image1.png
    • image2.png
    • etc.
  • image1-hd.png
  • image2-hd.png
  • image1-hd.png
  • image2-hd.png
  • etc.

您需要:

  • sd-spritesheet
    • image1.png
    • image2.png
  • sd-spritesheet
    • image1.png
    • image2.png
    • etc.
  • image1.png
  • image2.png
  • image1.png
  • image2.png
  • etc.

这篇关于cocos2d视网膜支持不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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