I display a BitmapFont
on the screen, update its text and the font is updated dynamically on the screen as well.
I seem to fail to do the same with a scene2d Label
added as actor to a Stage
.
The act(delta)
and draw()
methods are being called in the render()
method.
My code basically looks as follows:
public void init() {
Label label = new Label(text, labelStyle);
stage.addActor(label);
}
public void update() {
updateText(text);
}
@Override
public void resize(int width, int height) {
/* do some resizing */
label.setPosition(newPositionX, newPositionY);
}
@Override
public void render(float delta) {
/* do some rendering */
stage.act(delta);
stage.draw();
update();
}
Do I need to do anything other than setting the Label
text, adding it to the Stage
as actor, and then updating the text elsewhere? The label displays its original text, though the text updating works fine.
Thanks.