问题描述
当一个项目只有@ 2x图像因为它只针对视网膜显示设备时,atlas Sprite Kit图谱会将RGBA8888_COMPRESSED设置的比例设置错误以用于PVR纹理。 RGBA8888_PNG(默认)有时可以正常工作。
When a project only has @2x images because it only targets retina display devices, atlas Sprite Kit atlas gets the scale wrong with the RGBA8888_COMPRESSED setting to use with PVR textures. RGBA8888_PNG (the default) sometimes works ok.
在切换到地图集之前,我在一个组中拥有所有@ 2x图像并加载它们:
Before switching to atlas, I had all @2x images in a group and loaded them with:
sprite = [SKSpriteNode spriteNodeWithImageNamed:@"theImage.png"];
没问题。正确的大小。
现在使用atlas和RGBA8888_COMPRESSED,我得到了SKTexture,图像太大了。完全相同的节点和配置。只使用atlas的SKTexture。
Now with atlas and RGBA8888_COMPRESSED, I get the SKTexture and the image is way too large. Exact same nodes and configuration. Only using SKTexture from atlas instead.
为什么会这样?
推荐答案
地图集图片应该有@ 2x后缀,但不包含其中包含的文件。
The atlas image should have the @2x suffix but not the files contained in it.
无法使用
atlas.png contains [email protected]
正确用法:
[email protected] contains theImage.png
我甚至不确定Sprite Kit是否支持PVR纹理。也许尝试确认您的设置适用于PNG,然后导出为PVR并尝试。
I'm not even sure Sprite Kit supports PVR textures to begin with. Perhaps try confirming that your setup works with PNG and then export as PVR and try that.
当你这样做时,一定要清理你的项目(Xcode:Project - > Clean)并从设备/模拟器中删除应用程序(这一步至关重要!)否则捆绑包仍将包含PNG图集图像,你可能会误以为PVR有效,因为如果你不删除它并清理你的版本,Sprite Kit实际上可能会加载仍然存在于捆绑包中的PNG图集。
When you do that, be sure to clean your project (Xcode: Project -> Clean) and remove the app from the device/simulator (this step is crucial!) otherwise the bundle will still contain the PNG atlas image and you may be fooled into thinking that PVR works because Sprite Kit may actually load the PNG atlas that still exists in the bundle if you don't remove it and clean your build.
这篇关于如何使Sprite Kit以正确的大小显示来自atlas的@ 2x图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!