Reputation: 1077
Tying to use a own made skin.json file for styling Scene2d. But I still getting Json errors and I can't figure out why!
File named: uiskin2.json
{
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: { down: default-round-down, up: default-round, font: default-font }
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: { titleFont: default-font },
}
}
Error I'll get:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error reading file: uiskin2.json
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:97)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:74)
at Scene2D_UI_Wigets_Skins.Scene2dUi.create(Scene2dUi.java:17)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:147)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: uiskin2.json
at com.badlogic.gdx.utils.Json.fromJson(Json.java:694)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:95)
... 4 more
Caused by: com.badlogic.gdx.utils.SerializationException: Error parsing file: uiskin2.json
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:77)
at com.badlogic.gdx.utils.Json.fromJson(Json.java:692)
... 5 more
Caused by: com.badlogic.gdx.utils.SerializationException: Error parsing JSON, unmatched brace.
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:554)
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:55)
at com.badlogic.gdx.utils.JsonReader.parse(JsonReader.java:75)
... 6 more
The errors them self aren't saying much about the content within the uiskin2.json file, only parsing errors?
Doe's someone sees it? Do I need to specify default props like default-round-down
?
What am I missing here?
p.s Testes a skin from the internet which works just fine uiskin.json
Upvotes: 0
Views: 898
Reputation: 3146
The first thing I see is that you have a spurious comma after the third-from-last closing brace.
Try this...
{
com.badlogic.gdx.graphics.g2d.BitmapFont: {
default-font: {
file: default.fnt
}
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: {
down: default-round-down,
up: default-round,
font: default-font
}
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: {
titleFont: default-font
}
}
}
Upvotes: 3