R
R
ratatyq2017-09-23 22:33:01
Game development
ratatyq, 2017-09-23 22:33:01

Why is it throwing a `Missing LabelStyle font.` error?

Hello, the following problem arose:
There are files Author.json, default.fnt, Author.atlas, Author.png, and there is such code
Menu.java =>

stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
skin2 = new Skin(Gdx.files.internal("Author.json"));
TextButton bt_exit = new TextButton("click me", skin2, "default");

final Dialog dialog = new Dialog("", skin2);

dialog.text("hello world");
dialog.button(bt_exit);
dialog.show(stage);

And here's what's in Author.json =>
{
  com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
  com.badlogic.gdx.graphics.Color: {
    green: { a: 1, b: 0, g: 1, r: 0 },
    white: { a: 1, b: 1, g: 1, r: 1 },
    red: { a: 1, b: 0, g: 0, r: 1 },
    black: { a: 1, b: 0, g: 0, r: 0 },
  },
  com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default: {
      titleFont: default-font
    },
  },
  com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    default: {
      font: default-font,
      fontColor: white,
    },
  },
  com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
    default: {
      down: default-round-down,
      up: default-round,
    },
  }
}

And at the output it gives the following error
java.lang.IllegalArgumentException: Missing LabelStyle font.
Swears at the line =>
bt_exit = new TextButton("click me", skin2, "default");

And I can’t understand why there is a missing font ....
If without a button, then everything is ok, but it is necessary with a button

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question