如何阻止Cocos2D需要标准清晰度资源(SD映像)? [英] How do I stop Cocos2D from requiring standard definition resources (SD images)?

查看:99
本文介绍了如何阻止Cocos2D需要标准清晰度资源(SD映像)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Cocos2d-iphone开发一款iPhone游戏。

I am developing an iPhone game with Cocos2d-iphone.

我希望我的游戏只适用于iPhone 4和iPad。 Retina为iPhone 4启用。我不想让游戏在旧设备上运行。

I want my game to only be available to the iPhone 4 AND iPad. Retina enabled for iPhone 4. I don't want the game to run on older devices.

Cocos2d总是会问我-hd和非hd文件。如果我不提供SD文件,我得到错误。我不想那样:有没有办法禁用Cocos2d尝试检索SD文件,并且只有默认情况下获取-hd后缀文件?

Cocos2d will always ask me for -hd and non-hd files. If I don't provide the SD files, I get errors. I don't want that: is there a way to disable Cocos2d from trying to retrieve SD files, and only get -hd suffixed files by default?

哦,当游戏是由iPad运行,图形也将是-HD。所以关键是,我只想在我的项目中有-hd文件。

Oh, and when the game is run by an iPad, the graphics will be the -hd ones as well. So the point is, I only want to have -hd files in my project.

编辑Cocos2d的源代码是什么?

What are the proper steps to edit Cocos2d's source for such?

推荐答案

如果您使用cocos2d version> = 2.0,那么您可以更改 CCFileUtils.h中找到的全局变量的值

If you are using cocos2d version >= 2.0, then you can change the value of a global variable found in CCFileUtils.h:

static NSString *__suffixiPad =@"-hd";

(其默认值为 @ - ipad。)

如果您使用cocos2d版本< 2.0,则可以找到此处类别写得能够在iPad 1/2上透明地使用为iPhone 4创建的-hd图像。

If you are using cocos2d version < 2.0, then you can find here a category that I wrote to be able to transparently use -hd images created for the iPhone 4 on the iPad 1/2.

实际上,它做的不止这些,但如果你添加它到你的项目,那么-hd图像将在iPad 1/2上自动使用,而不是他们的SD版本(你也可以不包括在你的项目中)。

Actually, it does more than that, but if you add it to your project, then "-hd" images will be "automagically" used on the iPad 1/2 instead of their SD versions (which you could also not include in your project).

如果您在整合此代码时遇到任何问题,请与我们联系。

Let me know if you have any issues integrating this code.

这篇关于如何阻止Cocos2D需要标准清晰度资源(SD映像)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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