List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Cell maxSize
public Cell<T> maxSize(float width, float height)
From source file:de.fgerbig.spacepeng.screens.MenuScreen.java
License:Apache License
public MenuScreen(final SpacePeng game) { super(game);//www .j a v a 2s.com // 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 void setValues(Cell target, int tweenType, float[] newValues) { switch (tweenType) { case POS_X://from w ww . j ava2s.c o m //target.setX(newValues[0]); break; case POS_Y: //target.setY(newValues[0]); break; case POS_XY: //target.setPosition(newValues[0], newValues[1]); break; case SCALE_X: //target.setScale(newValues[0], target.getScaleY()); break; case SCALE_Y: //target.setScale(target.getScaleX(), newValues[0]); break; case SCALE_XY: target.maxSize(newValues[0], newValues[1]); break; case COLOR: //Color c = target.getColor(); //c.set(newValues[0], newValues[1], newValues[2], newValues[3]); //target.setColor(c); break; default: assert false; break; } }