Example usage for com.badlogic.gdx.scenes.scene2d.ui Label getFontScaleX

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Label getFontScaleX

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui Label getFontScaleX.

Prototype

public float getFontScaleX() 

Source Link

Usage

From source file:com.ahsgaming.valleyofbones.screens.LevelScreen.java

License:Apache License

public Group popupMessage(String text, String icon, float duration) {
    Gdx.app.log(LOG, "Popup message!");
    Group popup = new Group();
    Label lbl = new Label(text, getSkin(), "medium");
    lbl.setFontScale(VOBGame.SCALE);/*from ww  w  .j a  v  a  2s  .co  m*/
    Image img = new Image(VOBGame.instance.getTextureManager().getSpriteFromAtlas("assets", icon));
    popup.addActor(img);
    popup.addActor(lbl);
    lbl.setPosition(img.getRight(), (img.getHeight() - lbl.getHeight()) * 0.5f);
    popup.setSize(lbl.getX() + lbl.getWidth() * lbl.getFontScaleX(), img.getTop());
    popup.setPosition((stage.getWidth() - popup.getWidth()) * 0.5f,
            turnPanel.getY() - popup.getHeight() - 20 * VOBGame.SCALE);
    popup.setColor(popup.getColor().r, popup.getColor().g, popup.getColor().b, 0);
    stage.addActor(popup);
    popup.addAction(Actions.sequence(Actions.fadeIn(0.5f), Actions.delay(duration), Actions.fadeOut(0.5f),
            Actions.removeActor()));
    return popup;
}

From source file:se.danielj.slashatthegame.misc.LabelAccessor.java

License:GNU General Public License

@Override
public int getValues(Label target, int tweenType, float[] returnValues) {
    switch (tweenType) {
    case POSITION_X:
        returnValues[0] = target.getX();
        return 1;
    case POSITION_Y:
        returnValues[0] = target.getY();
        return 1;
    case POSITION_XY:
        returnValues[0] = target.getX();
        returnValues[1] = target.getY();
        return 2;
    case ALPHA://from  w  w w  .j  a  v  a  2s  .c  o m
        returnValues[0] = target.getColor().a;
        return 1;
    case SCALE:
        returnValues[0] = target.getFontScaleX();
        return 1;
    default:
        return -1;
    }
}