Skip to content Skip to sidebar Skip to footer

How Do I Scale A Label In Libgdx

i am trying to code a HUD for my game but i cannot figure out how to scale a Label properly I am using this code: Label hpLabel = new Label('HP: ',new Label.LabelStyle(new BitmapFo

Solution 1:

Simply add the Label to a Group then apply the scale to the group.

    Label label = new Label("hello", skin);
    Groupgroup = newGroup();
    group.addActor(label);
    group.setScale(2f, 2f);

I only scale Groups with Labels in animations where at the end of the animation the scale is 1. One should not scale fonts, because it looks pixelated. For example, a simple scale up scale down animation:

group.addAction(Actions.sequence(Actions.scaleTo(2f, 2f, 1f), Actions.scaleTo(1f, 1f, 1f)));

Solution 2:

Post a Comment for "How Do I Scale A Label In Libgdx"