[英]Loading error LibGDX/Scene2d
我得到这个:
线程“ LWJGL应用程序”中的异常com.badlogic.gdx.utils.SerializationException:读取文件ui / skin.json时出错
我正在尝试为我的scene2D ui加载皮肤,但完全失败了。
无论如何,当我上课时,该错误会在load方法中引发,所以这是一个加载问题吧?
另外,为什么不加载?
@Override
public void show() {
// Creates our atlas from our png file containing all the sprites
atlas = new TextureAtlas("ui/atlas.atlas");
// Create a stage, everything goes on the stage
stage = new Stage();
// A skin for the stage
skin = new Skin(Gdx.files.internal("ui/skin.json"), atlas);
该文件在那里,确切命名,项目已清理,刷新并重新导入。 甚至尝试将其移动到资产文件夹中。 只是不断抛出一个错误。
这是我的json文件:
{
"com.badlogic.gdx.graphics.Color": {
"white": { "r": 1, "g": 1, "b": 1, "a": 1 },
"black": { "r": 0, "g": 0, "b": 0, "a": 1 },
"red": { "r": 1, "g": 0, "b": 0, "a": 1 },
"green": { "r": 0, "g": 1, "b": 0, "a": 1 },
"blue": { "r": 0, "g": 0, "b": 1, "a": 1 }
},
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"fontSFNightly": { "file": "fonts/fontSFNightly.fnt" }
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"heading": { "font": "fontSFNightly", "fontColor": "white" }
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"mainMenu": { "up": "button.up", "down": "button.down", "pressedOffsetX": 1, "pressedOffsetY": -1 }
}
}
相当直截了当,跟随dermetfans的视频,这样我就可以了解有关程序结构的更多信息以及不了解的内容,这开始引起我的注意
我设法解决了。
事实证明,从JSON文件读取字体对象存在某种问题,我使用的是来自1001fonts.com的第三方字体,我不确定为什么它无法加载。
我将其更改为标准Windows ariel字体,现在尝试弄清楚为什么自定义字体无法正常工作。
因此,此问题在技术上已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.