libgdx TextArea多色错误

时间:2018-07-01 15:20:56

标签: java libgdx game-development

我的代码:

public TestClass(Skin skin) {
    super(skin);
    dateFormat = new SimpleDateFormat("HH:mm");
    textArea = new TextArea("",skin);
    textArea.getStyle().font.getData().markupEnabled = true;
    addMessage("message 1");
}

public void addMessage(String message) {
    textArea.appendText("[ORANGE]" + dateFormat.format(new Date()) + "   [BLUE]" + message + "\n");
}

错误:

Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 88
at com.badlogic.gdx.scenes.scene2d.ui.TextField.calculateOffsets(TextField.java:229)
at com.badlogic.gdx.scenes.scene2d.ui.TextArea.calculateOffsets(TextArea.java:268)
at com.badlogic.gdx.scenes.scene2d.ui.TextField.draw(TextField.java:318)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:110)
at com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.draw(ScrollPane.java:588)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:123)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57)
at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw(WidgetGroup.java:163)
at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:119)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:110)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:57)
at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128)
at com.mygdx.game.States.ClickerState.render(ClickerState.java:375)

我使用libgdx版本1.9.8

我忘记了什么吗?我尝试遵循以下示例:“ https://github.com/libgdx/libgdx/wiki/Color-Markup-Language

我尝试使用RRGGBBAA,但没有任何改变。

0 个答案:

没有答案