JSTileMap如何处理视网膜和ipad / iphone平铺贴图? [英] How does JSTileMap handle retina and ipad/iphone tile maps?

查看:101
本文介绍了JSTileMap如何处理视网膜和ipad / iphone平铺贴图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Tiled创建了一个基本的tilemap。我正在使用JSTileMap和SpriteKit来获取场景中的地图。据我所知,JSTileMap(相当于SKTexture)自动处理视网膜和不同的设备。到目前为止,我还没有能够产生好的结果,这是我的设置:

I have created a basic tilemap using Tiled. I am using JSTileMap with SpriteKit to get the map in the scene. As I understood, JSTileMap (rather SKTexture) handles the retina and different devices automatically. I have not been able to produce good results so far, here is my setup:

我有一个基本分辨率使用map.png创建的.tmx文件,因为它是瓷砖组。 .tmx存在于项目中,但我特意没有添加map.png(我不想支持非视网膜iPhone)。

I have one .tmx file created at a base resolution using map.png as it's tile set. The .tmx is present in the project but I purposely did not add map.png (I do not want to support non-retina iPhones).

在项目中我只添加了以下.png的:
map@2x~iphone.png(视网膜iPhone,使用48x48瓷砖)
map~ipad.png(非视网膜iPad,使用48x48瓷砖)
map @ 2x~ipad.png(视网膜iPad,使用96x96瓷砖)

In the project I only added the following .png's: map@2x~iphone.png (retina iPhones, using 48x48 tiles) map~ipad.png (non-retina iPads, using 48x48 tiles) map@2x~ipad.png (retina iPads, using 96x96 tiles)

以下是我得到的结果(在模拟器上清理构建和重置内容和设置之后):

Here are the results I get (after clean builds and reset content and settings on simulator):

Retina iPhone - 瓷砖是错误的地方

iPad - 没有显示瓷砖地图,JSTileMap有解析错误

Retina iPad - 瓷砖错误的地方

Retina iPhone - tiles is wrong spots
iPad - no tilemap displayed, JSTileMap has parsing error
Retina iPad - tiles in wrong spots

如果我只使用普通香草map.png(48x48瓷砖):

Retina iPhone - 瓷砖地图显示效果不错但当然太大了

iPad - 瓷砖地图完美显示

Retina iPad - 瓷砖地图显示完美且缩放。

If I use just a plain vanilla map.png (with 48x48 tiles):
Retina iPhone - tile map displays well but too large of course
iPad - tile map displays perfectly
Retina iPad - tile map display perfectly and is scaled.

我知道我可以使用24x24 tile map.png,显然它会扩展所有内容。我宁愿不使用缩放的瓷砖套装,因为质量会受到影响。

I know I could just use a 24x24 tile map.png and apparently it will scale everything. I would prefer not to use scaled tile sets as the quality would suffer.

提前致谢。

E

推荐答案

我能够缩小SKTexture忽略@ 2x文件扩展名的~ipad文件扩展名。这只会为尝试为iPhone视网膜,iPad和iPad视网膜构建一个瓷砖贴图系统带来更多麻烦。

I was able to narrow down that SKTexture ignores the ~ipad file extension for the @2x file extension. This only created more headaches in trying to build a tile map system for iPhone retina, iPad, and iPad retina.

我决定一起避免这个问题。我现在不在我的项目中使用通用应用程序。我有一个iPhone项目和一个单独的iPad项目。这样我使用Retina所需要做的就是每个项目中的@ 2x文件扩展名。

I have decided to avoid the problem all together. I am not using a universal app in my project now. I have a iPhone project and a separate iPad Project. This way all I need to do to work with Retina is the @2x file extension in each project.

这完全有效(更容易)。对于那些仅为视网膜iPhone构建的人来说,明智的一个词......在.tmx文件中是你的瓷砖高度和宽度大小的一半,否则你将有一个很好的时间来尝试处理内容缩放。

This does fully work (much easier). A word to the wise to those only building for retina iPhones... half your tile height and width sizes in the .tmx files, otherwise you will have a great time trying to deal with the content scaling.

这篇关于JSTileMap如何处理视网膜和ipad / iphone平铺贴图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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