List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Table Table
public Table(Skin skin)
From source file:at.hid.tabletopsimulator.screens.About.java
License:Apache License
@Override public void show() { TableTopSimulator.debug(this.getClass().toString(), "creating About screen"); stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); Gdx.input.setInputProcessor(stage);// w w w . j ava 2 s . c o m // creating skin TableTopSimulator.debug(this.getClass().toString(), "creating skin"); skin = TableTopSimulator.assets.get("ui/gui.json", Skin.class); table = new Table(skin); // table.setFillParent(true); // table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); // creating heading TableTopSimulator.debug(this.getClass().toString(), "creating heading"); Label lblHeading = new Label(TableTopSimulator.getLangBundle().format("About.lblHeading.text"), skin); final Label lblContent = new Label("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!", skin, "content"); // creating list final List<String> listAbout = new List<String>(skin, "content"); ArrayList<String> newItems = new ArrayList<String>(); newItems.add("libgdx"); newItems.add("libgdx-utils"); newItems.add("flare gameart"); String[] data = new String[newItems.size()]; listAbout.setItems(newItems.toArray(data)); listAbout.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (listAbout.getSelected().equals("libgdx")) { lblContent.clear(); lblContent.setText("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!"); } else if (listAbout.getSelected().equals("libgdx-utils")) { lblContent.clear(); lblContent.setText("https://bitbucket.org/dermetfan/libgdx-utils/wiki/Home\r\n" + "\r\n" + "/* Copyright (c) 2014 PixelScientists\r\n" + "*\r\n" + "* The MIT License (MIT)\r\n" + "*\r\n" + "* Permission is hereby granted, free of charge, to any person obtaining a copy of\r\n" + "* this software and associated documentation files (the \"Software\"), to deal in\r\n" + "* the Software without restriction, including without limitation the rights to\r\n" + "* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r\n" + "* the Software, and to permit persons to whom the Software is furnished to do so,\r\n" + "* subject to the following conditions:\r\n" + "*\r\n" + "* The above copyright notice and this permission notice shall be included in all\r\n" + "* copies or substantial portions of the Software.\r\n" + "*\r\n" + "* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n" + "* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r\n" + "* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r\n" + "* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r\n" + "* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n" + "* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n" + "*/"); } else if (listAbout.getSelected().equals("flare gameart")) { lblContent.clear(); lblContent.setText("https://github.com/clintbellanger/flare-game\r\n" + "\r\n" + "Flare (the game) is Copyright 2010-2013 Clint Bellanger. Contributors retain copyrights to their original contributions.\r\n" + "\r\n" + "The Flare Engine is released under GPL version 3 or later.\r\n" + "\r\n" + "All of Flare's art and data files are released under CC-BY-SA 3.0. Later versions are permitted.\r\n" + "\r\n" + "The Liberation Sans fonts version 2 are released under the SIL Open Font License, Version 1.1.\r\n" + "\r\n" + "The GNU Unifont font is released under GPL v2, with the exception that embedding the font in a document does not in itself bind that document to the terms of the GPL."); } } }); // creating buttons TableTopSimulator.debug(this.getClass().toString(), "creating buttons"); TextButton btnBack = new TextButton(TableTopSimulator.getLangBundle().format("About.btnBack.text"), skin); btnBack.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { TableTopSimulator.debug(this.getClass().toString(), "switching to Options screen"); ((Game) Gdx.app.getApplicationListener()).setScreen(new Options()); dispose(); } }); btnBack.pad(10); ScrollPane spAboutList = new ScrollPane(null, skin); ScrollPane spAboutContent = new ScrollPane(null, skin); SplitPane splitAbout = new SplitPane(spAboutList, spAboutContent, false, skin); splitAbout.setSplitAmount(0.2f); spAboutList.setWidget(listAbout); spAboutContent.setWidget(lblContent); // building ui TableTopSimulator.debug(this.getClass().toString(), "building ui"); table.add(lblHeading).spaceBottom(100).row(); table.add(splitAbout).spaceBottom(15).width(1200).row(); table.add(btnBack).spaceBottom(15).row(); if (TableTopSimulator.DEBUG) { table.debug(); // draw debug lines splitAbout.debug(); // draw debug lines } stage.addActor(table); }
From source file:ateamproject.kezuino.com.github.render.screens.GameScreen.java
public void showPlayersView() { this.playerMenu.clear(); TextButton btExit = new TextButton("Oke", skin); btExit.addListener(new ClickListener() { @Override/*from w w w . j a v a2 s.c o m*/ public void clicked(InputEvent event, float x, float y) { getSession().setPlayerMenuShowing(false); playerMenu.hide(); } }); this.playerMenu.add(btExit); Table scrollTable = new Table(skin); ArrayList<String> people = new ArrayList<>(); PacketGetKickInformation packetGetKickInfo = new PacketGetKickInformation(); Client.getInstance().send(packetGetKickInfo); people.addAll(packetGetKickInfo.getResult()); for (String person : people) { String[] peopleResult = person.split(" "); TextButton bKick = new TextButton("Kick", skin); bKick.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { PacketSetKickInformation packetKick = new PacketSetKickInformation( UUID.fromString(peopleResult[4]), null); Client.getInstance().send(packetKick); PacketGetKickInformation packetKickInfo = new PacketGetKickInformation(); Client.getInstance().send(packetKickInfo); people.clear(); people.addAll(packetKickInfo.getResult()); } }); scrollTable.add(peopleResult[0]); scrollTable.columnDefaults(0); scrollTable.add(bKick); scrollTable.columnDefaults(1); scrollTable.add(peopleResult[1] + "/" + peopleResult[2]); scrollTable.columnDefaults(2); scrollTable.row(); if (peopleResult[3].equals("true")) { bKick.setDisabled(true); bKick.setTouchable(Touchable.disabled); bKick.setColor(255, 0, 0, 100); } } playerMenu.add(scrollTable); this.playerMenu.show(stage); getSession().showPlayerMenu(); }
From source file:com.agateau.ui.UiBuilder.java
License:Apache License
protected Table createTable(XmlReader.Element element) { return new Table(mSkin); }
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();/* ww w.j ava 2 s . co m*/ 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);// ww w . ja v a2s.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.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 va 2 s .c o 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.aia.hichef.ui.n.MyDialog.java
License:Apache License
private void initialize() { setModal(true);/*from w w w .ja v a 2 s . c om*/ defaults().space(6); add(contentTable = new Table(skin)).expand().fill(); row(); add(buttonTable = new Table(skin)); contentTable.defaults().space(6); buttonTable.defaults().space(6); buttonTable.addListener(new ChangeListener() { public void changed(ChangeEvent event, Actor actor) { if (!values.containsKey(actor)) return; while (actor.getParent() != buttonTable) actor = actor.getParent(); result(values.get(actor)); if (!cancelHide) hide(); cancelHide = false; } }); addListener(new FocusListener() { public void keyboardFocusChanged(FocusEvent event, Actor actor, boolean focused) { if (!focused) focusChanged(event); } public void scrollFocusChanged(FocusEvent event, Actor actor, boolean focused) { if (!focused) focusChanged(event); } private void focusChanged(FocusEvent event) { Stage stage = getStage(); if (isModal() && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == MyDialog.this) { // Dialog // is // top // most // actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(MyDialog.this)) event.cancel(); } } }); }
From source file:com.andgate.pokeadot.GameScreen.java
License:Open Source License
private void buildPauseButtonScene() { pauseButtonStage = new Stage(); //pauseButtonStage.getViewport().setCamera(camera); ImageButton pauseButton = game.createIconButton(Constants.PAUSE_ICON_LOCATION, Constants.PAUSE_ICON_DOWN_LOCATION, new ClickListener() { @Override/*from ww w. j a v a 2 s . c o m*/ public void clicked(InputEvent event, float x, float y) { gameState = GameState.PAUSE; game.buttonPressedSound.play(); im.setProcessors(new Array<InputProcessor>( new InputProcessor[] { pauseMenuStage, new GameInputProcessor() })); } }); Table table = new Table(game.skin); table.bottom().left(); table.add(pauseButton).bottom().left(); table.setFillParent(true); pauseButtonStage.addActor(table); }
From source file:com.andgate.pokeadot.GameScreen.java
License:Open Source License
private void buildGameOverStage() { gameOverStage = new Stage(); //gameOverStage.getViewport().setCamera(camera); final Label.LabelStyle largeLabelStyle = new Label.LabelStyle(game.largeFont, new Color(1.0f, 0.0f, 0.0f, 0.7f)); final Label.LabelStyle smallLabelStyle = new Label.LabelStyle(game.smallFont, new Color(1.0f, 1.0f, 1.0f, 0.7f)); final Label gameOverLabel = new Label("Game Over", largeLabelStyle); final Label continueLabel = new Label(" ", smallLabelStyle); Table table = new Table(game.skin); table.add(gameOverLabel).center().row(); table.add(continueLabel).center().top().row(); table.setFillParent(true);//w ww.j av a2 s .co m gameOverStage.addActor(table); }
From source file:com.andgate.pokeadot.GameScreen.java
License:Open Source License
private void buildGameOverContinueStage() { gameOverStage = new Stage(); //gameOverStage.getViewport().setCamera(camera); final Label.LabelStyle largeLabelStyle = new Label.LabelStyle(game.largeFont, new Color(0.7f, 0.0f, 0.0f, 0.7f)); final Label.LabelStyle smallLabelStyle = new Label.LabelStyle(game.smallFont, new Color(1.0f, 1.0f, 1.0f, 0.7f)); final Label gameOverLabel = new Label("Game Over", largeLabelStyle); final Label continueLabel = new Label("tap to continue", smallLabelStyle); Table table = new Table(game.skin); table.add(gameOverLabel).center().row(); table.add(continueLabel).center().top().row(); table.setFillParent(true);//from w w w. j ava2 s. co m gameOverStage.addActor(table); }