栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

LibGDX-调用TiledMapRenderer.render()时应用程序崩溃

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

LibGDX-调用TiledMapRenderer.render()时应用程序崩溃

我发现了导致错误的原因:
1)我的“ packfile”中的所有图块均以-1作为其索引
2)我的“ packfile”中的所有图块均具有与原始图块文件名称相同的名称,但与包含所有打包图块的.png文件。

当前我的屏幕是黑色的,所以我认为没有绘制图块(可能是因为我对packfile中的图块提供了随机索引-已 修复,请参见文章末尾
),但是没有引发异常,这就是重点。

这些错误是由于我以前打包程序的程序造成的,该程序应该让我赢得时间大声笑。因此,我将尝试其他选项或使用其他选项。
如果您想知道该程序是“ TexturePacker GUI” v3.1.0。

如果您知道为避免错误我不应该使用的选项,请告诉我。

编辑: 找到了一个有用的打包瓷砖的工作工具,这里是:
http :
//freigabe.philweb.de/bubblr/texturepacker_edited.jar
(链接已死;请改用此== http://bit.ly/ 1a831nv或其他打包工具=>
http://bit.ly/1aLgAFt)

要使用它,请打开cmd并转到下载.jar文件的目录,然后:

//You should create, in the same directory of the .jar file, two additionnal folders//Call the first folder 'input' and put in all your tiles (rename them "level_1.png", "level_..")//Call the 2nd folder 'output' and leave it empty//Then just type in the command prompt : java -jar nameOfDownloadedJarFile.jar input output level//Then rename the "input1.png" into "level.png", and "level.pack" into "level packfile"//Open "level packfile" with notepad and change "input1.png" into "level.png"//Then draw your map using "level.png" in TiledMapEditor//Then just follow dpk' tutorial for rendering the map and it should work

这是我提到的dpk教程,只需从这里开始:http ://dpk.net/2011/05/01/libgdx-box2d-tiled-
maps-full-working-example-part-1/#p4

如果应用程序没有崩溃但屏幕为黑色,则只需增加摄像机视口的宽度和高度即可。

快乐的映射:)!



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/498067.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号