cocos2d视网膜支持不再起作用

编程入门 行业动态 更新时间:2024-10-28 08:30:51
本文介绍了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视网膜支持不再起作用

本文发布于:2023-06-05 01:10:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/508780.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视网膜   cocos2d

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!