带有Sprite Kit的硬件专用图谱在iPad上被炸毁 [英] Hardware specific atlas with Sprite Kit is blown up on iPad

查看:106
本文介绍了带有Sprite Kit的硬件专用图谱在iPad上被炸毁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

观看演讲503使用Sprite Kit设计游戏来自WWDC 2013,他们说纹理地图集的一个好处是你只需要将文件夹放到XCode上,它就可以为不同的设备生成特定于硬件的地图集(OSX, iPhone,iPhone Retina,iPad ......)

Watching talk 503 "Designing Games with Sprite Kit" from WWDC 2013, they say that one of the benefits of texture atlases is that you only need to drop a folder to XCode and it generate hardware specific atlases for different devices (OSX, iPhone, iPhone Retina, iPad...)

这是正确的吗?

我正在丢弃一个文件夹有一个用于精灵动画的帧,虽然在iPad 2和iPad视网膜上看起来大小相同,但它的大小是正确大小的两倍,当然,在iPad视网膜中,图像也是像素化的。

I'm dropping a folder with a frames for a sprite animation and though it appears the same size on iPad 2 and iPad retina, its size is twice the correct size, and, of course, in the iPad retina the image is pixelated.

我做错了什么?

推荐答案

简答:
附加一个你的.atlas文件夹中的每个视网膜png的@ 2x后缀(例如:heroimage@2x.png) - 这些将在Retina设备上正确显示。这使得视网膜显示器能够正确计算像素与点的比率(否则它们在Retina上的尺寸似乎是它们的两倍)。

具有相同名称但没有@ 2x后缀的文件将是一个非视网膜对应物。

Short answer:
Append a @2x suffix to each of your retina pngs inside your .atlas folder (example: heroimage@2x.png) - these will be then displayed correctly on Retina devices. This enables the retina display to calculate the ratio of pixels to points correctly (otherwise they'll appear to be double their size on Retina).
Files with the same name, but without the @2x suffix, will be the non-retina counterpart.

一个稍微复杂的答案:
如果你需要区分更多的设备,iPhone和iPad,你可以使用@ 2x ~ipad后缀和@ 2x~iphone分别用于Retina iPad和iPhone。但是,有报道称有这里有错误

A slightly more complex answer:
if you need to differentiate among more devices, iPhones and iPads, you can use the @2x~ipad suffix and @2x~iphone for the Retina iPad and iPhone, respectively. However, there have been reports of bugs here.

WWDC的含义可能是,如果您在纹理图集中为不同的设备(具有不同的后缀)放置图像,则生成集体图集图像确实是每个设备分开的。正如它在 iOS开发人员库中所述:

What was meant at WWDC is probably the fact that if you place images for different devices (with different suffixes) in your texture atlas, then the generated collective atlas images are indeed separate for each device. As it says in the iOS Developer Library:


同一设备的图像保存在一起 - 例如,所有iPhone
图像都在一个文件中(~iphone.1 .png),所有iPad图片都在
另一个文件(-ipad.1.png)。

Images for the same device are kept together—for example, all iPhone images are in one file (~iphone.1.png), and all iPad images are in another file (-ipad.1.png).

这篇关于带有Sprite Kit的硬件专用图谱在iPad上被炸毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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