Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Table#add()
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.Table#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicFloatRangeInputWidget.java From talos with Apache License 2.0 | 6 votes |
public DynamicFloatRangeInputWidget(Skin skin) { setSkin(skin); Table container = new Table(); highInput = new FloatRangeInputWidget("HMin", "HMax", getSkin()); lowInput = new FloatRangeInputWidget("LMin", "LMax", getSkin()); lowInput.setValue(0, 0); highInput.setValue(1, 1); container.add(highInput).row(); container.add().height(3).row(); container.add(lowInput); add(container).left().expandX(); curveWidget = new CurveWidget(getSkin()); add(curveWidget).left().growY().width(100).padTop(23).padRight(3).padLeft(4).padBottom(3); }
Example 2
Source File: MainMenuScreen.java From xibalba with MIT License | 6 votes |
/** * Main Menu Screen. * * @param main Instance of main class */ public MainMenuScreen(Main main) { stage = new Stage(new FitViewport(960, 540)); Table table = new Table(); table.setFillParent(true); stage.addActor(table); ActionButton newGameButton = new ActionButton("N", "New Game"); newGameButton.setKeys(Input.Keys.N); newGameButton.setAction(table, () -> main.setScreen(new YouScreen(main))); ActionButton quitButton = new ActionButton("Q", "Quit"); quitButton.setKeys(Input.Keys.Q); quitButton.setAction(table, () -> Gdx.app.exit()); table.add(new Label("[LIGHT_GRAY]Xibalba v0.1.0[]", Main.skin)).pad(0, 0, 10, 0); table.row(); table.add(newGameButton).pad(0, 0, 10, 0); table.row(); table.add(quitButton); Gdx.input.setInputProcessor(stage); stage.setKeyboardFocus(table); }
Example 3
Source File: CardViewBig.java From Cardshifter with Apache License 2.0 | 6 votes |
public CardViewBig(CardshifterGame game, CardInfoMessage cardInfo) { this.properties = new HashMap<String, Object>(cardInfo.getProperties()); this.id = cardInfo.getId(); table = new Table(game.skin); table.add((String) cardInfo.getProperties().get("name")); costs = new HorizontalGroup(); costs.addActor(new Label("A", game.skin)); table.add(costs).row(); // table.add(image); Table textTable = new Table(game.skin); textTable.add("Abilities").row(); textTable.add("Effect").row(); textTable.add("Flavortext").bottom(); table.add(textTable).colspan(2).row(); table.add("Type").left(); gives = new HorizontalGroup(); gives.addActor(new Label("ABC", game.skin)); table.add(gives).right(); }
Example 4
Source File: PropertyTable.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public PropertyTable(Skin skin) { // super(skin); table = new Table(skin); this.skin = skin; top().left(); table.top().left(); table.add(new Label("Name", skin)); table.add(new Label("Value", skin)); table.setFillParent(true); fill(); prefHeight(1000); setActor(table); }
Example 5
Source File: BlockingWindow.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
@Override protected void initialize() { table.defaults().pad(2); Table content = new Table(); content.defaults().pad(2); content.add(new Blink(0)); content.add(new Blink(1)); content.add(new Blink(2)); content.row(); content.add(new Blink(7)); content.add(); content.add(new Blink(3)); content.row(); content.add(new Blink(6)); content.add(new Blink(5)); content.add(new Blink(4)); table.add(content); }
Example 6
Source File: ResumeVsJoinTest.java From gdx-ai with Apache License 2.0 | 6 votes |
@Override public Actor createActor (final Skin skin) { Table table = new Table(); LabelStyle labelStyle = new LabelStyle(skin.get(LabelStyle.class)); labelStyle.background = skin.newDrawable("white", .6f, .6f, .6f, 1); String branchChildren = "\n spinAround\n selectTarget\n pursue"; table.add(new Label("parallel policy:\"sequence\" orchestrator:\"resume\"" + branchChildren, labelStyle)).pad(5); table.add(new Label("vs", skin)).padLeft(10).padRight(10); table.add(new Label("parallel policy:\"sequence\" orchestrator:\"join\"" + branchChildren, labelStyle)).pad(5); table.row().padTop(15); TextButton startButton = new TextButton("Start", skin); startButton.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { oldScreen = container.getScreen(); container.setScreen(new TestScreen(ResumeVsJoinTest.this, skin)); } }); table.add(); table.add(startButton); table.add(); return table; }
Example 7
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxLinearSpeedController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxSpeed = new Label("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]", container.skin); table.add(labelMaxSpeed); table.row(); Slider maxSpeed = new Slider(minValue, maxValue, step, false, container.skin); maxSpeed.setValue(limiter.getMaxLinearSpeed()); maxSpeed.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxLinearSpeed(slider.getValue()); labelMaxSpeed.setText("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]"); } }); table.add(maxSpeed); }
Example 8
Source File: Vector2InputPanel.java From bladecoder-adventure-engine with Apache License 2.0 | 5 votes |
Vector2InputPanel(Skin skin, String title, String desc, boolean mandatory, String defaultValue) { dimPanel = new Table(skin); x = new TextField("", skin); y = new TextField("", skin); dimPanel.add(new Label(" x ", skin)); dimPanel.add(x); dimPanel.add(new Label(" y ", skin)); dimPanel.add(y); init(skin, title, desc, dimPanel, mandatory, defaultValue); }
Example 9
Source File: CellWidget.java From vis-ui with Apache License 2.0 | 5 votes |
/** * @param table will contain a cell with the object's widget with specified cell settings. * @param defaultWidgetPadding will be applied to the cell if padding was not specified. Can be null. * @return a reference to the built cell. */ public Cell<?> buildCell (final Table table, final Padding defaultWidgetPadding) { final Cell<?> cell = table.add(widget); applyPadding(cell, defaultWidgetPadding); applySizeData(cell); applyFillingData(cell); return cell; }
Example 10
Source File: MonsterLabelManager.java From riiablo with Apache License 2.0 | 5 votes |
MonsterLabel() { label = new Table(); label.setBackground(new PaletteIndexedColorDrawable(Riiablo.colors.darkRed) {{ setTopHeight(VERTICAL_PADDING); setBottomHeight(VERTICAL_PADDING); setLeftWidth(HORIZONTAL_PADDING); setRightWidth(HORIZONTAL_PADDING); }}); label.add(name = new com.riiablo.widget.Label(Riiablo.fonts.font16)); label.pack(); add(label).space(4).center().row(); add(type = new Label(Riiablo.fonts.ReallyTheLastSucker)).row(); pack(); }
Example 11
Source File: VisualSettingsMenu.java From Radix with MIT License | 5 votes |
@Override public void init() { VisualSettings visualSettings = RadixClient.getInstance().getSettingsManager().getVisualSettings(); stage = new Stage(); Table table = new Table(); table.setFillParent(true); table.add(visualSettings.getFancyTrees().getManipulationActor()); table.add(visualSettings.getPerCornerLight().getManipulationActor()); table.row(); table.add(visualSettings.getNonContinuous().getManipulationActor()); table.add(visualSettings.getFinishEachFrame().getManipulationActor()); stage.addActor(table); }
Example 12
Source File: AudibleTwoTextButton.java From ingress-apk-mod with Apache License 2.0 | 5 votes |
public AudibleTwoTextButton(String text1, String text2, TwoTextButtonStyle style) { super(style); Label label1 = new Label(text1, new Label.LabelStyle(style.font, style.fontColor)); Label label2 = new Label(text2, new Label.LabelStyle(style.font2, style.fontColor2)); label1.setAlignment(1); label2.setAlignment(1); Table t = new Table(); t.add(label1); t.add(label2); add(t).center().expand().fill(); setWidth(getPrefWidth()); setHeight(getPrefHeight()); }
Example 13
Source File: StatusBar.java From ninja-rabbit with GNU General Public License v2.0 | 5 votes |
public StatusBar(final Batch batch, final AssetManager assets) { overlay = new Stage(new ScreenViewport(), batch); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = Color.WHITE; style.font = assets.get(Assets.HUD_FONT); style.font.setFixedWidthGlyphs(NUMBER_GLYPHS); collectiblesLabel = new Label(String.format(TWO_DIGITS, 0), style); livesLabel = new Label(String.format(TWO_DIGITS, 0), style); scoreLabel = new Label(String.format(EIGHT_DIGITS, 0), style); timeLabel = new Label(String.format(THREE_DIGITS, 0), style); TextureAtlas hudAtlas = assets.get(Assets.NINJA_RABBIT_ATLAS); Table table = new Table(); table.add(new Image(hudAtlas.findRegion(SMALL_CARROT_REGION))).padRight(8.0f); table.add(collectiblesLabel).bottom(); table.add(new Image(hudAtlas.findRegion(LIVES_REGION))).padLeft(15.0f); table.add(livesLabel).bottom(); table.add(scoreLabel).expandX(); table.add(new Image(hudAtlas.findRegion(TIME_REGION))).padRight(12.0f); table.add(timeLabel); table.setFillParent(true); table.top(); table.pad(15.0f); overlay.addActor(table); }
Example 14
Source File: TabbedPane.java From gdx-ai with Apache License 2.0 | 5 votes |
private void initialize () { setTouchable(Touchable.enabled); tabTitleTable = new Table(); tabBodyStack = new Stack(); selectedIndex = -1; // Create 1st row Cell<?> leftCell = add(new Image(style.titleBegin)); Cell<?> midCell = add(tabTitleTable); Cell<?> rightCell = add(new Image(style.titleEnd)); switch (tabTitleAlign) { case Align.left: leftCell.width(((Image)leftCell.getActor()).getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(((Image)rightCell.getActor()).getWidth()).bottom(); break; case Align.center: leftCell.expandX().fillX().bottom(); midCell.center(); rightCell.expandX().fillX().bottom(); break; default: throw new IllegalArgumentException("TabbedPane align must be one of left, center, right"); } // Create 2nd row row(); Table t = new Table(); t.setBackground(style.bodyBackground); t.add(tabBodyStack); add(t).colspan(3).expand().fill(); }
Example 15
Source File: PauseScreen.java From xibalba with MIT License | 5 votes |
/** * Main Menu Screen. * * @param main Instance of main class */ public PauseScreen(Main main) { stage = new Stage(new FitViewport(960, 540)); Table table = new Table(); table.setFillParent(true); stage.addActor(table); ActionButton returnToGameButton = new ActionButton("ESC", "Return to Game"); returnToGameButton.setKeys(Input.Keys.ESCAPE); returnToGameButton.setAction(table, () -> main.setScreen(Main.playScreen)); ActionButton mainMenuButton = new ActionButton("M", "Main Menu"); mainMenuButton.setKeys(Input.Keys.M); mainMenuButton.setAction(table, () -> { Main.playScreen.dispose(); main.setScreen(new MainMenuScreen(main)); }); ActionButton quitButton = new ActionButton("Q", "Quit"); quitButton.setKeys(Input.Keys.Q); quitButton.setAction(table, () -> Gdx.app.exit()); table.add(new Label("[LIGHT_GRAY]PAUSED[]", Main.skin)).pad(0, 0, 10, 0); table.row(); table.add(returnToGameButton).pad(0, 0, 10, 0); table.row(); table.add(mainMenuButton).pad(0, 0, 10, 0); table.row(); table.add(quitButton); Gdx.input.setInputProcessor(stage); stage.setKeyboardFocus(table); }
Example 16
Source File: LoadingScreen.java From xibalba with MIT License | 5 votes |
/** * Loading screen. * * @param main Instance of Main */ public LoadingScreen(Main main) { this.main = main; stage = new Stage(new FitViewport(960, 540)); Table table = new Table(); table.setFillParent(true); stage.addActor(table); label = new Label("", Main.skin); table.add(label); new Thread(() -> Gdx.app.postRunnable(this::loadAssets)).start(); }
Example 17
Source File: ConflictWindow.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
@Override protected void doShow(Params params) { callback = params.callback; 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); }
Example 18
Source File: CraftScreen.java From xibalba with MIT License | 4 votes |
/** * Craft screen. * * @param main Instance of Main */ public CraftScreen(Main main) { stage = new Stage(new FitViewport(960, 540)); Constructor constructor = new Constructor(ItemData.class); constructor.addTypeDescription(new TypeDescription(Bleed.class, "!Bleed")); constructor.addTypeDescription(new TypeDescription(Charm.class, "!Charm")); constructor.addTypeDescription(new TypeDescription(DealDamage.class, "!DealDamage")); constructor.addTypeDescription(new TypeDescription(Poison.class, "!Poison")); constructor.addTypeDescription(new TypeDescription(RaiseHealth.class, "!RaiseHealth")); constructor.addTypeDescription(new TypeDescription(StartFire.class, "!StartFire")); TypeDescription itemDescription = new TypeDescription(ItemData.class); itemDescription.putListPropertyType("requiredComponent", ItemRequiredComponentData.class); constructor.addTypeDescription(itemDescription); Yaml yaml = new Yaml(constructor); recipes = new HashMap<>(); for (Map.Entry<String, String> entry : Main.itemsData.entrySet()) { ItemData data = (ItemData) yaml.load(entry.getValue()); if (data.requiredComponents != null) { recipes.put(entry.getKey(), data); } } table = new Table(); table.setFillParent(true); table.left().top(); stage.addActor(table); Table titleTable = new Table(); HorizontalGroup titleGroup = new HorizontalGroup(); titleGroup.space(10); titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20); ActionButton closeButton = new ActionButton("Q", null); closeButton.setKeys(Input.Keys.Q); closeButton.setAction(table, () -> main.setScreen(Main.playScreen)); titleGroup.addActor(closeButton); Label title = new Label("Craft", Main.skin); titleGroup.addActor(title); recipeGroup = new VerticalGroup().top().left().columnLeft(); Table craftTable = new Table(); craftTable.add(recipeGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2); table.add(titleTable); table.row(); table.add(craftTable).left(); setupRecipes(); Gdx.input.setInputProcessor(stage); stage.setKeyboardFocus(table); }
Example 19
Source File: AbilitiesScreen.java From xibalba with MIT License | 4 votes |
/** * View and use your abilities. * * @param main Instance of Main */ public AbilitiesScreen(Main main) { this.main = main; abilities = ComponentMappers.abilities.get(WorldManager.player).abilities; playerDetails = ComponentMappers.player.get(WorldManager.player); stage = new Stage(new FitViewport(960, 540)); table = new Table(); table.setFillParent(true); table.left().top(); stage.addActor(table); Table titleTable = new Table(); HorizontalGroup titleGroup = new HorizontalGroup(); titleGroup.space(10); titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20); ActionButton closeButton = new ActionButton("Q", null); closeButton.setKeys(Input.Keys.Q); closeButton.setAction(table, () -> main.setScreen(Main.playScreen)); titleGroup.addActor(closeButton); Label title = new Label("Abilities", Main.skin); titleGroup.addActor(title); abilitiesGroup = new VerticalGroup().top().left().columnLeft(); Table abilitiesTable = new Table(); abilitiesTable.add(abilitiesGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2); table.add(titleTable); table.row(); table.add(abilitiesTable).left(); setupAbilities(); Gdx.input.setInputProcessor(stage); stage.setKeyboardFocus(table); }
Example 20
Source File: HelpScreen.java From xibalba with MIT License | 4 votes |
/** * Help screen. * * @param main Instance of Main */ public HelpScreen(Main main) { stage = new Stage(new FitViewport(960, 540)); Table table = new Table(); table.setFillParent(true); table.left().top(); stage.addActor(table); Table titleTable = new Table(); HorizontalGroup titleGroup = new HorizontalGroup(); titleGroup.space(10); titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20); ActionButton closeButton = new ActionButton("Q", null); closeButton.setKeys(Input.Keys.Q); closeButton.setAction(table, () -> main.setScreen(Main.playScreen)); titleGroup.addActor(closeButton); Label title = new Label("Help", Main.skin); titleGroup.addActor(title); VerticalGroup group = new VerticalGroup().top().left().columnLeft(); Table helpTable = new Table(); helpTable.add(group).pad(10).top().left(); group.addActor(new Label("[DARK_GRAY]Movement & melee attacks:[] numpad keys", Main.skin)); group.addActor(new Label("[DARK_GRAY]Shoot range weapon:[] r", Main.skin)); group.addActor(new Label("[DARK_GRAY]Focused attack:[] shift + attack key", Main.skin)); group.addActor(new Label("[DARK_GRAY]Look at a tile you're not on:[] s", Main.skin)); group.addActor(new Label("[DARK_GRAY]Throw:[] t", Main.skin)); group.addActor(new Label("[DARK_GRAY]Confirm action:[] space", Main.skin)); group.addActor(new Label("[DARK_GRAY]Close dialogs or cancel actions:[] q", Main.skin)); table.add(titleTable); table.row(); table.add(helpTable).left(); Gdx.input.setInputProcessor(stage); stage.setKeyboardFocus(table); }