I'm trying to initize a TextButton
by giving it a JSON file which contains the style of the button, however I keep getting the following error:
Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Missing LabelStyle font.
After researching what the error was about, it seems that this message shows up when you forget to include a font as part of the TextButtonStyle
, however i do include that in my JSON file, so i don't know why it keeps showing.
Here's my json file
{
"com.badlogic.gdx.graphics.Color":{
"golden":{"r":255,"g":215,"b":0,"a":1}
},
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"arcade": {"file": "arcade.fnt"}
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"default": {
"font": arcade,
"fontColor": golden
}
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"buttonstyle1": {
"up": "unpressedtextbutton",
"down": "pressedtextbutton",
"font": arcade
}
}
}
and in the code I initialize the button like this:
Skin skin = new Skin(Gdx.files.internal("buttonstyles.json"),new TextureAtlas(Gdx.files.internal("uistuff.atlas")));
myTextButton = new TextButton("text of the button",skin,"buttonstyle1")
My theory is that somehow it is not reading the font file "arcade.fnt", i'm assuming that the directory it reads the files from is the assets folder, and that's where my "arcade.fnt" file is located.