Example usage for com.badlogic.gdx.scenes.scene2d.ui Cell getMaxHeight

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Cell getMaxHeight

Introduction

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

Prototype

public float getMaxHeight() 

Source Link

Usage

From source file:de.fgerbig.spacepeng.screens.MenuScreen.java

License:Apache License

public MenuScreen(final SpacePeng game) {
    super(game);/*www  .ja v  a  2 s.co m*/

    // retrieve the default table actor
    Table table = super.getTable();
    table.setSkin(game.getSkin());

    Label label = new Label("SPACE PENG!", game.getSkin());
    label.setStyle(labelStyle_Heading);
    table.add(label).spaceBottom(25);
    table.row();

    profile = SpacePeng.profileManager.retrieveProfile();

    if (profile.getLastPlayedLevel() > 1) {
        // register the button "start game"
        continueGameButton = new TextButton("Level " + profile.getLastPlayedLevel(), game.getSkin());
        continueGameButton.setStyle(textButtonStyle_Default);
        continueGameButton.addListener(new DefaultInputListener() {
            @Override
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                super.touchUp(event, x, y, pointer, button);
                SpacePeng.soundManager.play(SoundKey.CLICK);
                game.setScreen(new GameScreen(game));
            }
        });
        table.add(continueGameButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform()
                .spaceBottom(BUTTON_HEIGHT / 3);
        table.row();
    }

    // register the button "start game"
    String title = (profile.getLastPlayedLevel() > 1) ? "RESTART" : "START";
    startGameButton = new TextButton(title, game.getSkin());
    startGameButton.setStyle(textButtonStyle_Default);
    startGameButton.addListener(new DefaultInputListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            SpacePeng.soundManager.play(SoundKey.CLICK);
            profile.setLastPlayedLevel(1);
            game.setScreen(new GameScreen(game));
        }
    });
    table.add(startGameButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().spaceBottom(BUTTON_SPACING);
    table.row();

    // register the button "Credits"
    creditsButton = new TextButton("Credits", game.getSkin());
    creditsButton.setStyle(textButtonStyle_Default);
    creditsButton.addListener(new DefaultInputListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            SpacePeng.soundManager.play(SoundKey.CLICK);
            game.setScreen(new CreditsScreen(game));
        }
    });
    table.add(creditsButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING);
    table.row();

    // register the button "options"
    optionsButton = new TextButton("Options", game.getSkin());
    optionsButton.setStyle(textButtonStyle_Default);
    optionsButton.addListener(new DefaultInputListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            SpacePeng.soundManager.play(SoundKey.CLICK);
            game.setScreen(new OptionsScreen(game));
        }
    });
    table.add(optionsButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_HEIGHT / 3);
    table.row();

    // register the button "quit"
    quitButton = new TextButton("QUIT", game.getSkin());
    quitButton.setStyle(textButtonStyle_Default);
    quitButton.addListener(new DefaultInputListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            super.touchUp(event, x, y, pointer, button);
            SpacePeng.soundManager.play(SoundKey.CLICK);
            game.pause();
            game.dispose();
        }
    });
    table.add(quitButton).size(BUTTON_WIDTH, BUTTON_HEIGHT);

    Cell cell;

    if (profile.getLastPlayedLevel() > 1) {
        cell = table.getCell(continueGameButton);
        continueGameButton_w = cell.getMaxWidth();
        continueGameButton_h = cell.getMaxHeight();
        cell.maxSize(BUTTON_START_WIDTH, BUTTON_START_HEIGHT);
    }

    cell = table.getCell(startGameButton);
    startGameButton_w = cell.getMaxWidth();
    startGameButton_h = cell.getMaxHeight();
    cell.maxSize(BUTTON_START_WIDTH, BUTTON_START_HEIGHT);

    cell = table.getCell(creditsButton);
    creditsButton_w = cell.getMaxWidth();
    creditsButton_h = cell.getMaxHeight();
    cell.maxSize(BUTTON_START_WIDTH, BUTTON_START_HEIGHT);

    cell = table.getCell(optionsButton);
    optionsButton_w = cell.getMaxWidth();
    optionsButton_h = cell.getMaxHeight();
    cell.maxSize(BUTTON_START_WIDTH, BUTTON_START_HEIGHT);

    cell = table.getCell(quitButton);
    quitButton_w = cell.getMaxWidth();
    quitButton_h = cell.getMaxHeight();
    cell.maxSize(BUTTON_START_WIDTH, BUTTON_START_HEIGHT);

    getTable().invalidate();
}

From source file:de.fgerbig.spacepeng.tween.CellTween.java

License:Open Source License

@Override
public int getValues(Cell target, int tweenType, float[] returnValues) {
    switch (tweenType) {

    case POS_X:// ww  w . j a  v  a 2  s  .co m
        //returnValues[0] = target.getX();
        return 1;
    case POS_Y:
        //returnValues[0] = target.getY();
        return 1;
    case POS_XY:
        //returnValues[0] = target.getX();
        //returnValues[1] = target.getY();
        return 2;

    case SCALE_X:
        //returnValues[0] = target.getScaleX();
        return 1;
    case SCALE_Y:
        //returnValues[0] = target.getScaleY();
        return 1;
    case SCALE_XY:
        returnValues[0] = target.getMaxWidth();
        returnValues[1] = target.getMaxHeight();
        return 2;

    case COLOR:
        //                returnValues[0] = target.getColor().r;
        //                returnValues[1] = target.getColor().g;
        //                returnValues[2] = target.getColor().b;
        //                returnValues[3] = target.getColor().a;
        return 4;

    default:
        assert false;
        return -1;
    }
}