I am trying to make a Table
that has a Skin
based on libgdx's default LabelStyle
and BitmapFont
through the use of a json
file. (this file is supposed to hold the references of these two objects) In doing this I am getting some unclear errors. For instance:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:96) at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:73) at com.naitsirc.Interpolation.Test.show(Test.java:47) at com.badlogic.gdx.Game.setScreen(Game.java:61) at com.naitsirc.Interpolation.InterpolationTest.create(InterpolationTest.java:9) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json at com.badlogic.gdx.utils.Json.fromJson(Json.java:662) at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:94) ... 6 more Caused by: com.badlogic.gdx.utils.SerializationException: Serialization trace: font (com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle) at com.badlogic.gdx.utils.Json.readFields(Json.java:762) at com.badlogic.gdx.utils.Json.readValue(Json.java:865) at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:418) at com.badlogic.gdx.utils.Json.readValue(Json.java:809) at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.readNamedObjects(Skin.java:439) at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:428) at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:424) at com.badlogic.gdx.utils.Json.readValue(Json.java:839) at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:418) at com.badlogic.gdx.utils.Json.fromJson(Json.java:660) ... 7 more Caused by: com.badlogic.gdx.utils.GdxRuntimeException: No com.badlogic.gdx.graphics.g2d.BitmapFont registered with name: default-font at com.badlogic.gdx.scenes.scene2d.ui.Skin.get(Skin.java:145) at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:417) at com.badlogic.gdx.utils.Json.readFields(Json.java:755) ... 16 more*
This is where I create my skin
with the json
:
public void show() { Gdx.input.setInputProcessor(stage = new Stage()); skin = new Skin(Gdx.files.internal("ui/uiskin.json")); // HERE container = new Table(); table = new Table(skin); for(int i = 0; i < interpolationNames.length; i++){ //table.row(); table.add(interpolationNames[i]); // I am trying to populate these table cells } ScrollPane pane = new ScrollPane(table); container.add(pane); stage.addActor(container); renderer = new ShapeRenderer(); }
My json
file:
{ com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: { default: { font: default-font, fontColor: white } }, com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } } }
What am I doing incorrectly?
Note
I seem to have the same problem as here but what I did is the same thing, and its not working.