Example usage for com.badlogic.gdx.scenes.scene2d.utils Align bottomLeft

List of usage examples for com.badlogic.gdx.scenes.scene2d.utils Align bottomLeft

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.utils Align bottomLeft.

Prototype

int bottomLeft

To view the source code for com.badlogic.gdx.scenes.scene2d.utils Align bottomLeft.

Click Source Link

Usage

From source file:com.jmstudios.pointandhit.TutorialScreen.java

License:Open Source License

public TutorialScreen(final OneShotGame game, boolean automatic) {
    this.game = game;
    this.automatic = automatic;
    this.scale = game.scale;

    batch = new SpriteBatch();
    shapeRenderer = new ShapeRenderer();
    screenSize = new Vector2(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    textFont = new BitmapFont(Gdx.files.internal("fonts/deja_vu_sans_medium.fnt"));
    textFont.setScale(scale);/* w w  w .ja  va 2s  .  c o  m*/

    infoLabelStyle = new Label.LabelStyle(textFont, Color.WHITE);

    tapToLabelStyle = new Label.LabelStyle(textFont, Color.LIGHT_GRAY);

    // Step 1
    float padding = 50 * scale;
    step1Stage = new Stage();
    step1Table = new Table();
    step1Table.setFillParent(true);
    step1Table.align(Align.bottomLeft);

    step1TiltInfo = new Label(tiltInfo, infoLabelStyle);
    step1TiltInfo.setWrap(true);
    step1TiltInfo.setWidth(screenSize.x - padding * 2);
    step1TiltInfo.setAlignment(Align.center);

    step1TapInfo = new Label(tapInfo, infoLabelStyle);
    step1TapInfo.setWrap(true);
    step1TapInfo.setWidth(screenSize.x - padding * 2);
    step1TapInfo.setAlignment(Align.center);

    step1TapToContinue = new Label(tapToContinue, tapToLabelStyle);
    step1TapToContinue.setWrap(true);
    step1TapToContinue.setWidth(screenSize.x - padding * 2);
    step1TapToContinue.setAlignment(Align.center);

    step1Table.defaults().pad(padding);
    step1Table.add(step1TiltInfo).width(screenSize.x - padding * 2);
    step1Table.row();
    step1Table.add(step1TapInfo).width(screenSize.x - padding * 2);
    step1Table.row();
    step1Table.add(step1TapToContinue).width(screenSize.x - padding * 2);
    step1Stage.addActor(step1Table);

    // Step 2
    step2Stage = new Stage();
    step2Table = new Table();
    step2Table.setFillParent(true);
    step2Table.align(Align.bottomLeft);

    step2ObjectiveInfo = new Label(objectiveInfo, infoLabelStyle);
    step2ObjectiveInfo.setWrap(true);
    step2ObjectiveInfo.setWidth(screenSize.x - padding * 2);
    step2ObjectiveInfo.setAlignment(Align.center);

    step2ShootToContinue = new Label(shootToContinueInfo, tapToLabelStyle);
    step2ShootToContinue.setWrap(true);
    step2ShootToContinue.setWidth(screenSize.x - padding * 2);
    step2ShootToContinue.setAlignment(Align.center);

    step2Table.defaults().pad(padding);
    step2Table.add(step2ObjectiveInfo).width(screenSize.x - padding * 2);
    step2Table.row();
    step2Table.add(step2ShootToContinue).width(screenSize.x - padding * 2);
    step2Stage.addActor(step2Table);

    // Done
    doneStage = new Stage();
    doneTable = new Table();
    doneTable.setFillParent(true);
    doneTable.align(Align.left);

    doneEndMessage = new Label(endMessage, infoLabelStyle);
    doneEndMessage.setWrap(true);
    doneEndMessage.setWidth(screenSize.x - padding * 2);
    doneEndMessage.setAlignment(Align.center);

    if (automatic) {
        tapToPlay = "Tap to finish...";
    }

    doneTapToInfo = new Label(tapToPlay, tapToLabelStyle);
    doneTapToInfo.setWrap(true);
    doneTapToInfo.setWidth(screenSize.x - padding * 2);
    doneTapToInfo.setAlignment(Align.center);

    doneTable.defaults().pad(padding);
    doneTable.add(doneEndMessage).width(screenSize.x - padding * 2);
    doneTable.row();
    doneTable.add(doneTapToInfo).width(screenSize.x - padding * 2);
    doneStage.addActor(doneTable);
}