List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Table add
public Cell<Label> add(String text, String fontName, String colorName)
From source file:com.ahsgaming.superrummy.screens.MainMenuScreen.java
License:Apache License
@Override public void resize(int width, int height) { super.resize(width, height); Skin skin = getSkin();//from w w w.ja va2 s . com TextButton btnNewGame = new TextButton("Single Player", skin); btnNewGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnNewGame.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(RummyGame.LOG, "btnNewGame touched"); } }); TextButton btnJoinMPGame = new TextButton("Multiplayer", skin); btnJoinMPGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnJoinMPGame.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(RummyGame.LOG, "btnJoinMPGame touched"); } }); TextButton btnOptions = new TextButton("Options", skin); btnOptions.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnOptions.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(RummyGame.LOG, "btnOptions touched"); } }); TextButton btnExit = new TextButton("Exit", skin); btnExit.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnExit.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(RummyGame.LOG, "btnExit touched"); } }); Table table = new Table(skin); table.setFillParent(true); stage.addActor(table); table.add("Valley of Bones", "medium-font", new Color(1, 1, 1, 1)).spaceBottom(50f).colspan(2); table.row(); table.add(btnNewGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnJoinMPGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnOptions).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnExit).uniform().size(BUTTON_WIDTH, BUTTON_HEIGHT).spaceBottom(BUTTON_SPACING).colspan(2); table.row(); }
From source file:com.ahsgaming.valleyofbones.screens.GameOverScreen.java
License:Apache License
public void updateLayout() { Table table = new Table(getSkin()); stage.addActor(table);//from w w w . jav a 2 s . c o m if (game.getPlayer() != null) { if (result.winner == game.getPlayer().getPlayerId()) { table.add("VICTORY", "large-font", "white").pad(4).colspan(4).center(); } else { table.add("DEFEAT", "large-font", "white").pad(4).colspan(4).center(); } } else { table.add("GAME OVER", "large-font", "white").pad(4).colspan(4).center(); } table.row(); table.row(); table.add().pad(4); table.add("Name", "small-font", "white").pad(4).minWidth(250); Image imgMoney = new Image(VOBGame.instance.getTextureManager().getSpriteFromAtlas("assets", "supply")); table.add(imgMoney).pad(4).size(imgMoney.getWidth() / VOBGame.SCALE, imgMoney.getHeight() / VOBGame.SCALE); Image imgSupply = new Image(VOBGame.instance.getTextureManager().getSpriteFromAtlas("assets", "money")); table.add(imgSupply).pad(4).size(imgSupply.getWidth() / VOBGame.SCALE, imgSupply.getHeight() / VOBGame.SCALE); table.row(); addPlayerRow(table, players, result.winner, "*"); for (int l = 0; l < result.losers.length; l++) { addPlayerRow(table, players, result.losers[l], ""); } TextButton btnMainMenu = new TextButton("Back to Main Menu", getSkin()); table.add(btnMainMenu).left().minSize(150, 50).pad(4).colspan(4); table.row(); btnMainMenu.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); game.setScreen(new MainMenuScreen(game)); } }); table.setPosition((stage.getWidth() - table.getWidth()) * 0.5f, stage.getHeight() * 0.75f - table.getHeight()); }
From source file:com.ahsgaming.valleyofbones.screens.GameOverScreen.java
License:Apache License
public void addPlayerRow(Table table, Array<Player> players, int playerId, String pre) { Player p = null;//from ww w . ja v a 2 s .com for (Player pl : players) { if (pl.getPlayerId() == playerId) { p = pl; break; } } if (p != null) { table.add(pre, "small-font", p.getPlayerColor()).pad(4); table.add(p.getPlayerName(), "small-font", p.getPlayerColor()).pad(4).left(); table.add(String.format("%02d/%02d", p.getCurFood(), p.getMaxFood()), "small-font", p.getPlayerColor()) .pad(4); table.add(String.format("$%04d", (int) p.getBankMoney()), "small-font", p.getPlayerColor()).pad(4); table.row().pad(4); } }
From source file:com.ahsgaming.valleyofbones.screens.MainMenuScreen.java
License:Apache License
@Override public void resize(int width, int height) { super.resize(width, height); Skin skin = getSkin();//w w w .j a v a 2s .co m for (Texture t : skin.getAtlas().getTextures()) { Gdx.app.log("Filter", t.getMinFilter().toString()); } TextButton btnNewGame = new TextButton("Single Player", skin); btnNewGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnNewGame.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(VOBGame.LOG, "btnNewGame touched"); game.setScreen(game.getGameSetupScreen()); } }); TextButton btnJoinMPGame = new TextButton("Multiplayer", skin); btnJoinMPGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnJoinMPGame.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(VOBGame.LOG, "btnJoinMPGame touched"); //game.setScreen(game.getGameSetupScreenMP(false)); // TODO implement a multiplayer version of this game.setScreen(game.getGameJoinScreen()); } }); TextButton btnOptions = new TextButton("Options", skin); btnOptions.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnOptions.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(VOBGame.LOG, "btnOptions touched"); game.setScreen(game.getOptionsScreen()); } }); TextButton btnExit = new TextButton("Exit", skin); btnExit.setSize(BUTTON_WIDTH, BUTTON_HEIGHT); btnExit.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.app.log(VOBGame.LOG, "btnExit touched"); game.quitGame(); } }); Table table = new Table(skin); table.setFillParent(true); stage.addActor(table); table.add("Valley of Bones", "medium-font", new Color(1, 1, 1, 1)).spaceBottom(50f).colspan(2); table.row(); table.add(btnNewGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnJoinMPGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnOptions).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING) .colspan(2); table.row(); table.add(btnExit).uniform().size(BUTTON_WIDTH, BUTTON_HEIGHT).spaceBottom(BUTTON_SPACING).colspan(2); table.row(); Label lblVersion = new Label("Version: " + VOBGame.VERSION, getSkin()); stage.addActor(lblVersion); }
From source file:com.vlaaad.dice.ui.windows.ConflictWindow.java
License:Open Source License
@Override protected void doShow(Params params) { callback = params.callback;//from w w w . j av a 2 s . c o m Table content = new Table(Config.skin); content.defaults().pad(2); content.setTouchable(Touchable.enabled); content.setBackground("ui-store-window-background"); LocLabel desc = new LocLabel("ui-conflict-description"); desc.setWrap(true); desc.setAlignment(Align.center); Table diff = new Table(Config.skin); diff.defaults().uniform().pad(1); UserData local = params.localData; UserData server = params.serverData; diff.add(String.valueOf(local.numPassedLevels()), "default", AboutWindow.INACTIVE).expandX(); final Tile levels = new Tile("ui/conflict-window/levels"); Hint.make(levels, "ui-conflict-window-levels"); diff.add(levels); diff.add(String.valueOf(server.numPassedLevels()), "default", AboutWindow.INACTIVE).expandX(); diff.row(); diff.add(String.valueOf(local.diceCount()), "default", AboutWindow.INACTIVE); final Tile dice = new Tile("ui/conflict-window/dice"); Hint.make(dice, "ui-conflict-window-dice"); diff.add(dice); diff.add(String.valueOf(server.diceCount()), "default", AboutWindow.INACTIVE); diff.row(); Item coin = Config.items.get("coin"); diff.add(String.valueOf(local.getItemCount(coin)), "default", AboutWindow.INACTIVE); final Tile coins = new Tile("ui/conflict-window/coins"); Hint.make(coins, "ui-conflict-window-coins"); diff.add(coins); diff.add(String.valueOf(server.getItemCount(coin)), "default", AboutWindow.INACTIVE); diff.row(); diff.add(String.valueOf(local.potionsCount()), "default", AboutWindow.INACTIVE); final Tile potions = new Tile("ui/conflict-window/potions"); Hint.make(potions, "ui-conflict-window-potions"); diff.add(potions); diff.add(String.valueOf(server.potionsCount()), "default", AboutWindow.INACTIVE); diff.row(); diff.add(String.valueOf(local.itemsCount(Item.Type.ingredient)), "default", AboutWindow.INACTIVE); final Tile ingredients = new Tile("ui/conflict-window/ingredients"); Hint.make(ingredients, "ui-conflict-window-ingredients"); diff.add(ingredients); diff.add(String.valueOf(server.itemsCount(Item.Type.ingredient)), "default", AboutWindow.INACTIVE); LocTextButton useLocal = new LocTextButton("ui-use-local"); useLocal.addListener(listener(GameMapState.ConflictResolution.useLocal)); LocTextButton useServer = new LocTextButton("ui-use-server"); useServer.addListener(listener(GameMapState.ConflictResolution.useServer)); Table buttons = new Table(); buttons.defaults().uniformX(); buttons.add(useLocal).expandX().fillX().padRight(3); buttons.add(useServer).expandX().fillX(); content.add(new LocLabel("ui-conflict-header")).padBottom(0).row(); content.add(desc).width(130).padTop(0).row(); content.add(new Tile("ui-creature-info-line")).width(80).pad(4).row(); content.add(diff).width(110).padBottom(3).row(); content.add(buttons).expandX().fillX(); table.add(content); }