List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Stack Stack
public Stack()
From source file:com.badlogic.gdx.ai.tests.msg.MessageTestBase.java
License:Apache License
public void create() { lastUpdateTime = 0;/* w w w .j a v a2s . c om*/ testStack = new Stack(); container.stage.getRoot().addActorAt(0, testStack); testStack.setSize(container.stageWidth, container.stageHeight); testStack.add(testTable = new Table() { @Override public void act(float delta) { float time = GdxAI.getTimepiece().getTime(); if (lastUpdateTime != time) { lastUpdateTime = time; super.act(GdxAI.getTimepiece().getDeltaTime()); } } }); testStack.layout(); }
From source file:com.badlogic.gdx.ai.tests.utils.scene2d.TabbedPane.java
License:Apache License
private void initialize() { setTouchable(Touchable.enabled);//from w w w . j ava 2s . c o m 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(); }
From source file:com.forerunnergames.peril.client.ui.screens.game.play.modes.classic.ClassicModePlayScreen.java
License:Open Source License
public ClassicModePlayScreen(final ClassicModePlayScreenWidgetFactory widgetFactory, final ScreenChanger screenChanger, final ScreenSize screenSize, final MouseInput mouseInput, final Batch batch, final MBassador<Event> eventBus, final DebugEventGenerator debugEventGenerator) { super(widgetFactory, screenChanger, screenSize, mouseInput, batch, eventBus); Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(screenSize, "screenSize"); Arguments.checkIsNotNull(mouseInput, "mouseInput"); Arguments.checkIsNotNull(eventBus, "eventBus"); Arguments.checkIsNotNull(debugEventGenerator, "debugEventGenerator"); this.widgetFactory = widgetFactory; this.debugEventGenerator = debugEventGenerator; playMapTableForegroundImage = widgetFactory.createPlayMapTableForegroundImage(); statusBox = widgetFactory.createStatusBox(); chatBox = widgetFactory.createChatBox(eventBus); personBox = widgetFactory.createPersonBox(); intelBox = widgetFactory.createIntelBox(new ChangeListener() { @Override/*from w w w.j a v a2s .co m*/ public void changed(final ChangeEvent event, final Actor actor) { // TODO Implement detailed report button. log.debug("Clicked detailed report button"); } }); controlRoomBox = widgetFactory.createControlRoomBox(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { // TODO Implement TradeInDialog & TradeInPhaseHandler. log.debug("Clicked trade-in button"); if (tradeInEvent == null) return; // TODO Production: Remove. publish(new PlayerTradeInCardsRequestEvent(tradeInEvent.getMatches().iterator().next())); controlRoomBox.disableButton(ControlRoomBox.Button.TRADE_IN); tradeInEvent = null; // TODO Production: Remove. } }, new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { log.debug("Clicked fortify button"); attackingBattlePhaseHandler.onEndBattlePhase(); controlRoomBox.disableButton(ControlRoomBox.Button.FORTIFY); controlRoomBox.disableButton(ControlRoomBox.Button.END_TURN); } }, new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { log.debug("Clicked end turn button"); publish(new EndPlayerTurnRequestEvent()); controlRoomBox.disableButton(ControlRoomBox.Button.FORTIFY); controlRoomBox.disableButton(ControlRoomBox.Button.END_TURN); } }, new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { log.debug("Clicked my settings button"); // TODO Implement My Settings button. } }, new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { log.debug("Clicked quit button"); final PlayScreenQuitDialog quitDialog = allDialogs.get(PlayScreenQuitDialog.class); quitDialog.show(isGameInProgress.get(), isSpectating.get()); } }); final Stack rootStack = new Stack(); rootStack.setFillParent(true); rootStack.setDebug(DEBUG, true); final Stack playMapTableStack = new Stack(); final Table playMapTable = new Table().top().left().pad(4); playMapCell = playMapTable.add(playMap.asActor()).expand().fill(); playMapTableStack.add(playMapTable); playMapTableStack.add(playMapTableForegroundImage); playMapTableStack.setDebug(DEBUG, true); playMapTable.setDebug(DEBUG, true); final Table sideBarTable = new Table().top().left(); sideBarTable.add(intelBox.asActor()).size(296, 484).spaceBottom(6).fill(); sideBarTable.row(); sideBarTable.add(controlRoomBox.asActor()).size(296, 318).spaceTop(6).fill(); sideBarTable.setDebug(DEBUG, true); // @formatter:off final Table topTable = new Table().top().left(); topTable.add(playMapTableStack).size(PlayMapSettings.ACTUAL_WIDTH + 8, PlayMapSettings.ACTUAL_HEIGHT + 8) .spaceRight(6).fill(); topTable.add(sideBarTable).spaceLeft(6).size(296, PlayMapSettings.ACTUAL_HEIGHT + 8).fill(); topTable.setDebug(DEBUG, true); // @formatter:on final Table bottomTable = new Table().top().left(); bottomTable.add(statusBox.asActor()).size(700, 256).spaceRight(6).fill(); bottomTable.add(chatBox.asActor()).size(700, 256).spaceLeft(6).spaceRight(6).fill(); bottomTable.add(personBox.asActor()).size(498, 256).spaceLeft(6).fill(); bottomTable.setDebug(DEBUG, true); final Table screenTable = new Table().top().left().pad(5); screenTable.add(topTable).height(808).left().spaceBottom(6).fill(); screenTable.row().spaceTop(6); screenTable.add(bottomTable).height(256).fill(); screenTable.setDebug(DEBUG, true); rootStack.add(screenTable); addRootActor(rootStack); // @formatter:off statusMessageGenerator = new StatusMessageGenerator(statusBox, widgetFactory); final BattleDialogListener attackDialogListener = new DefaultAttackDialogListener(allDialogs, playMap, mouseInput); final BattleDialogListener defendDialogListener = new DefaultDefendDialogListener(allDialogs, playMap, mouseInput); final PlayScreenDialogListener attackerBattleResultDialogListener = new AttackerBattleResultDialogListener( allDialogs, playMap, mouseInput); final PlayScreenDialogListener defenderBattleResultDialogListener = new DefenderBattleResultDialogListener( allDialogs, playMap, mouseInput); final PlayScreenDialogListener occupationDialogListener = new OccupationDialogListener(allDialogs, playMap, mouseInput); final PlayScreenCancellableDialogListener fortificationDialogListener = new FortificationDialogListener( allDialogs, playMap, mouseInput); final PlayScreenDialogListener notificationDialogListener = new DefaultPlayScreenDialogListener(allDialogs, mouseInput, playMap); final PlayScreenCancellableDialogListener quitDialogListener = new QuitDialogListener(allDialogs, playMap, mouseInput); allDialogListeners.add(attackDialogListener, defendDialogListener, attackerBattleResultDialogListener, defenderBattleResultDialogListener, occupationDialogListener, fortificationDialogListener, notificationDialogListener, quitDialogListener); final Dialog attackerBattleResultDialog = widgetFactory.createAttackerBattleResultDialog(getStage(), attackerBattleResultDialogListener); final Dialog defenderBattleResultDialog = widgetFactory.createDefenderBattleResultDialog(getStage(), defenderBattleResultDialogListener); final OccupationDialog occupationDialog = widgetFactory.createOccupationDialog(getStage(), occupationDialogListener); final FortificationDialog fortificationDialog = widgetFactory.createFortificationDialog(getStage(), fortificationDialogListener); final ReinforcementDialog reinforcementDialog = widgetFactory.createReinforcementDialog(getStage(), personBox, new ReinforcementDialogListener()); final Dialog quitDialog = widgetFactory.createQuitDialog("", getStage(), quitDialogListener); notificationDialog = widgetFactory.createNotificationDialog(widgetFactory, getStage(), notificationDialogListener); allDialogs.add(attackerBattleResultDialog, defenderBattleResultDialog, occupationDialog, fortificationDialog, reinforcementDialog, notificationDialog, quitDialog); reinforcementPhaseHandler = new ReinforcementPhaseHandler(playMap, reinforcementDialog, eventBus); manualCountryAssignmentPhaseHandler = new ManualCountryAssignmentPhaseHandler(playMap, eventBus); occupationPhaseHandler = new OccupationPhaseHandler(playMap, occupationDialog, eventBus); fortificationPhaseHandler = new FortificationPhaseHandler(playMap, fortificationDialog, eventBus); gamePhaseHandlers.add(reinforcementPhaseHandler, manualCountryAssignmentPhaseHandler, occupationPhaseHandler, fortificationPhaseHandler); // @formatter:on }
From source file:com.forerunnergames.peril.client.ui.screens.game.play.modes.classic.dialogs.armymovement.AbstractArmyMovementDialog.java
License:Open Source License
protected AbstractArmyMovementDialog(final ClassicModePlayScreenWidgetFactory widgetFactory, final String title, final Stage stage, final DialogListener listener) { // @formatter:off super(widgetFactory, DialogStyle.builder().windowStyle(StyleSettings.ARMY_MOVEMENT_DIALOG_WINDOW_STYLE).modal(false) .movable(true).size(862, 484).position(481, ScreenSettings.REFERENCE_SCREEN_HEIGHT - 164) .title(title).titleHeight(58).messageBox(false).border(28).buttonSize(90, 32).debug(DEBUG) .build(),/* www.j av a2 s. c om*/ stage, listener); // @formatter:on Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(stage, "stage"); this.widgetFactory = widgetFactory; sourceCountryNameLabel = widgetFactory.createArmyMovementDialogCountryNameLabel(); targetCountryNameLabel = widgetFactory.createArmyMovementDialogCountryNameLabel(); slider = widgetFactory.createArmyMovementDialogSlider(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { updateCountryArmies(); updateSubmitability(); } }); minButton = widgetFactory.createArmyMovementDialogMinButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { setSliderToMinValue(); } }); minusButton = widgetFactory.createArmyMovementDialogMinusButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { decrementSlider(); } }); plusButton = widgetFactory.createArmyMovementDialogPlusButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { incrementSlider(); } }); maxButton = widgetFactory.createArmyMovementDialogMaxButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { setSliderToMaxValue(); } }); sourceCountryStack = new Stack(); targetCountryStack = new Stack(); sourceCountryStack.setDebug(DEBUG, true); targetCountryStack.setDebug(DEBUG, true); final Table sourceCountryStackTable = new Table(); sourceCountryStackCell = sourceCountryStackTable.add(sourceCountryStack) .padRight(SOURCE_COUNTRY_ARROW_WIDTH); sourceCountryStackTable.setDebug(DEBUG, true); final Table targetCountryStackTable = new Table(); targetCountryStackCell = targetCountryStackTable.add(targetCountryStack) .padLeft(TARGET_COUNTRY_ARROW_WIDTH); targetCountryStackTable.setDebug(DEBUG, true); final Table sourceCountryTable = new Table(); sourceCountryTable.add(sourceCountryStackTable); sourceCountryTable.setClip(true); sourceCountryTable.setDebug(DEBUG, true); final Table targetCountryTable = new Table(); targetCountryTable.add(targetCountryStackTable); targetCountryTable.setClip(true); targetCountryTable.setDebug(DEBUG, true); final Table countryTable = new Table().center(); countryTable.add(sourceCountryTable).width(COUNTRY_BOX_WIDTH).maxHeight(COUNTRY_BOX_HEIGHT) .spaceRight(SOURCE_TARGET_COUNTRY_BOX_SPACING).padLeft(COUNTRY_BOX_INNER_PADDING) .padRight(COUNTRY_BOX_INNER_PADDING); countryTable.add(targetCountryTable).width(COUNTRY_BOX_WIDTH).maxHeight(COUNTRY_BOX_HEIGHT) .spaceLeft(SOURCE_TARGET_COUNTRY_BOX_SPACING).padLeft(COUNTRY_BOX_INNER_PADDING) .padRight(COUNTRY_BOX_INNER_PADDING); countryTable.setDebug(DEBUG, true); final Table sliderTable = new Table(); sliderTable.add(minButton).width(20).spaceRight(7); sliderTable.add(minusButton).width(30).spaceLeft(7).spaceRight(10); sliderTable.add(slider).width(382).height(12).spaceLeft(10).spaceRight(10); sliderTable.add(plusButton).width(30).spaceLeft(10).spaceRight(7); sliderTable.add(maxButton).width(20).spaceLeft(7); sliderTable.setDebug(DEBUG, true); getContentTable().defaults().space(0).pad(0); getContentTable().top(); getContentTable().row().size(COUNTRY_NAME_BOX_WIDTH, COUNTRY_NAME_BOX_HEIGHT).spaceBottom(1); getContentTable().add(sourceCountryNameLabel); getContentTable().add(targetCountryNameLabel); getContentTable().row().colspan(2).height(COUNTRY_BOX_HEIGHT).spaceTop(1); getContentTable().add(countryTable).padLeft(2).padRight(2).padTop(COUNTRY_BOX_INNER_PADDING - 2) .padBottom(COUNTRY_BOX_INNER_PADDING); getContentTable().row().colspan(2).top().padTop(29); getContentTable().add(sliderTable); addListener(new InputListener() { @Override public boolean keyDown(final InputEvent event, final int keycode) { if (!isShown()) return false; switch (keycode) { case Input.Keys.LEFT: { decrementSlider(); return true; } case Input.Keys.RIGHT: { incrementSlider(); return true; } default: { return false; } } } }); }
From source file:com.forerunnergames.peril.client.ui.screens.game.play.modes.classic.dialogs.battle.AbstractBattleDialog.java
License:Open Source License
protected AbstractBattleDialog(final BattleDialogWidgetFactory widgetFactory, final String title, final Stage stage, final ScreenShaker screenShaker, final BattleDialogListener listener) { // @formatter:off super(widgetFactory, DialogStyle.builder().windowStyle(StyleSettings.BATTLE_DIALOG_WINDOW_STYLE).modal(false) .movable(true).size(990, 432).position(405, ScreenSettings.REFERENCE_SCREEN_HEIGHT - 178) .title(title).titleHeight(56).messageBox(false).border(28).buttonSpacing(16) .buttonTextPaddingHorizontal(6).debug(DEBUG).build(), stage, listener);/*from w w w . jav a 2 s .c o m*/ // @formatter:on Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(stage, "stage"); Arguments.checkIsNotNull(screenShaker, "screenShaker"); Arguments.checkIsNotNull(listener, "listener"); this.widgetFactory = widgetFactory; this.screenShaker = screenShaker; this.listener = listener; attackingPlayerNameLabel = widgetFactory.createBattleDialogPlayerNameLabel(); defendingPlayerNameLabel = widgetFactory.createBattleDialogPlayerNameLabel(); attackingCountryNameLabel = widgetFactory.createBattleDialogCountryNameLabel(); defendingCountryNameLabel = widgetFactory.createBattleDialogCountryNameLabel(); battlingArrowLabel = widgetFactory.createBattleDialogBattlingArrowLabel(); attackerDice = widgetFactory.createAttackerDice(); defenderDice = widgetFactory.createDefenderDice(); diceArrows = widgetFactory.createBattleDialogDiceArrows(); attackingCountryArmyText = widgetFactory.createCountryArmyText(); attackingCountryArmyTextEffects = widgetFactory.createAttackingCountryArmyTextEffects(); defendingCountryArmyText = widgetFactory.createCountryArmyText(); defendingCountryArmyTextEffects = widgetFactory.createDefendingCountryArmyTextEffects(); battleSingleExplosionSoundEffect = widgetFactory.createBattleSingleExplosionSoundEffect(); battleAmbienceSoundEffect = widgetFactory.createBattleAmbienceSoundEffect(); attackingCountryStack = new Stack(); defendingCountryStack = new Stack(); final Table attackingCountryTable = new Table(); attackingCountryTable.add(attackingCountryStack); attackingCountryTable.setClip(true); attackingCountryTable.setDebug(DEBUG, true); final Table defendingCountryTable = new Table(); defendingCountryTable.add(defendingCountryStack); defendingCountryTable.setClip(true); defendingCountryTable.setDebug(DEBUG, true); final Table diceTable = new Table().pad(2); diceTable.add(attackerDice.asActor()).spaceRight(22).top(); diceTable.add(defenderDice.asActor()).spaceLeft(22).top(); diceTable.setDebug(DEBUG, true); final Table diceArrowsTable = new Table().top().padTop(10); diceArrowsTable.add(diceArrows.asActor()); diceArrowsTable.setDebug(DEBUG, true); final Stack diceTableStack = new Stack(); diceTableStack.add(diceTable); diceTableStack.add(diceArrowsTable); diceTableStack.setDebug(DEBUG, true); final Table leftTable = new Table().top().pad(2); leftTable.add(attackingPlayerNameLabel).size(PLAYER_NAME_BOX_WIDTH, PLAYER_NAME_BOX_HEIGHT).space(2); leftTable.row(); leftTable.add(attackingCountryTable).size(COUNTRY_BOX_WIDTH, COUNTRY_BOX_HEIGHT) .padBottom(COUNTRY_BOX_INNER_PADDING + 3).space(2); leftTable.row(); leftTable.add(attackingCountryNameLabel).size(COUNTRY_NAME_BOX_WIDTH, COUNTRY_NAME_BOX_HEIGHT).space(2); leftTable.setDebug(DEBUG, true); final Table centerTable = new Table().top().padTop(2).padBottom(2); centerTable.add(battlingArrowLabel).padRight(8) .padTop(24 - BATTLING_ARROW_LABEL_TEXT_VERTICAL_INNER_PADDING) .padBottom(51 + BATTLING_ARROW_LABEL_TEXT_VERTICAL_INNER_PADDING); centerTable.row(); centerTable.add(diceTableStack).size(94, 116); centerTable.setDebug(DEBUG, true); final Table rightTable = new Table().top().pad(2); rightTable.add(defendingPlayerNameLabel).size(PLAYER_NAME_BOX_WIDTH, PLAYER_NAME_BOX_HEIGHT).space(2); rightTable.row(); rightTable.add(defendingCountryTable).size(COUNTRY_BOX_WIDTH, COUNTRY_BOX_HEIGHT) .padBottom(COUNTRY_BOX_INNER_PADDING + 3).space(2); rightTable.row(); rightTable.add(defendingCountryNameLabel).size(COUNTRY_NAME_BOX_WIDTH, COUNTRY_NAME_BOX_HEIGHT).space(2); rightTable.setDebug(DEBUG, true); getContentTable().defaults().space(0).pad(0); getContentTable().top(); getContentTable().add(leftTable).size(404, 264); getContentTable().add(centerTable).size(126, 264); getContentTable().add(rightTable).size(404, 264); getContentTable().row(); }
From source file:com.forerunnergames.peril.client.ui.screens.loading.AbstractLoadingScreen.java
License:Open Source License
public AbstractLoadingScreen(final LoadingScreenWidgetFactory widgetFactory, final ScreenChanger screenChanger, final ScreenSize screenSize, final MouseInput mouseInput, final Batch batch, final MBassador<Event> eventBus, final AssetManager assetManager, final LoadingScreenStyle style) { super(widgetFactory, screenChanger, screenSize, mouseInput, batch, eventBus); Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(assetManager, "assetManager"); Arguments.checkIsNotNull(style, "style"); this.assetManager = assetManager; this.style = style; progressBar = widgetFactory.createProgressBar(style); final Label loadingTitleTextLabel = widgetFactory.createLoadingTitleLabel(style); final int loadingTitleTextLabelWidth = style.getLoadingTitleTextLabelWidth(); final int loadingTitleTextLabelHeight = style.getLoadingTitleTextLabelHeight(); loadingStatusTextLabel = widgetFactory.createLoadingStatusLabel(style); final Stack rootStack = new Stack(); rootStack.setFillParent(true);//from www . ja v a 2 s . c o m rootStack.add(widgetFactory.createBackground()); // @formatter:off final Table foregroundTable = new Table().top(); foregroundTable.add().height(style.getLoadingTitleTextVerticalSpacer()); foregroundTable.row(); foregroundTable.add(loadingTitleTextLabel).size(loadingTitleTextLabelWidth, loadingTitleTextLabelHeight); foregroundTable.row().bottom(); foregroundTable.add(progressBar).size(style.getProgressBarWidth(), style.getProgressBarHeight()) .padBottom(style.getProgressBarStatusTextSpacer()); foregroundTable.row(); foregroundTable.add(loadingStatusTextLabel); // @formatter:on rootStack.add(foregroundTable); addRootActor(rootStack); quitDialog = createQuitDialog(style.getQuitDialogMessageText(), new QuitDialogListener()); errorDialog = createErrorDialog(new ErrorDialogListener()); }
From source file:com.forerunnergames.peril.client.ui.screens.menus.AbstractMenuScreen.java
License:Open Source License
protected AbstractMenuScreen(final MenuScreenWidgetFactory widgetFactory, final ScreenChanger screenChanger, final ScreenSize screenSize, final MouseInput mouseInput, final Batch batch, final MBassador<Event> eventBus) { super(widgetFactory, screenChanger, screenSize, mouseInput, batch, eventBus); Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(screenChanger, "screenChanger"); Arguments.checkIsNotNull(screenSize, "screenSize"); Arguments.checkIsNotNull(batch, "batch"); this.widgetFactory = widgetFactory; screenBackgroundLeft = widgetFactory.createScreenBackgroundLeft(); screenBackgroundRight = widgetFactory.createScreenBackgroundRight(); menuBar = widgetFactory.createMenuBar(); rightBackgroundShadow = widgetFactory.createRightBackgroundShadow(); topBackgroundShadow = widgetFactory.createTopBackgroundShadow(); bottomBackgroundShadow = widgetFactory.createBottomBackgroundShadow(); titleBackground = widgetFactory.createTitleBackground(); leftMenuBarShadow = widgetFactory.createLeftMenuBarShadow(); rightMenuBarShadow = widgetFactory.createRightMenuBarShadow(); titleLabel = widgetFactory.createTitle("", Align.left); subTitleLabel = widgetFactory.createSubTitle("", Align.left); // Layer 0 - screen background rootStack = new Stack(); rootStack.setFillParent(true);//w w w . j ava2 s . c o m tableL0 = new Table().top().left(); tableL0.add(screenBackgroundLeft); tableL0.add().expandX(); tableL0.add(screenBackgroundRight); rootStack.add(tableL0); // Layer 1 - menu bar & right background shadow tableL1 = new Table().top().left(); tableL1.add().width(300); tableL1.add(menuBar).width(currentMenuBarState.getWidth()).fillX().expandY().fillY(); tableL1.add(rightBackgroundShadow).expandY().fill(); rootStack.add(tableL1); // Layer 2 - top & bottom background shadows tableL2 = new Table().top().left(); tableL2.add().width(300); tableL2.add(topBackgroundShadow).size(692, 302).fill(); tableL2.row(); tableL2.add().expandY(); tableL2.row(); tableL2.add(); tableL2.add(bottomBackgroundShadow).size(692, 302).fill(); rootStack.add(tableL2); // Layer 3 - title background tableL3 = new Table().top().left(); tableL3.add().width(301).height(400); tableL3.row(); tableL3.add(); titleBackgroundCell = tableL3.add(titleBackground).width(currentMenuBarState.getWidth() - 2).height(0) .fill(); rootStack.add(tableL3); // Layer 4 - title text, menu choices, & buttons interactionTable = new Table().top().left(); interactionTable.add().width(301).height(400); interactionTable.row(); interactionTable.add(); titleTable = new Table().left(); titlesTableCell = interactionTable.add(titleTable).padLeft(30).width(currentMenuBarState.getWidth() - 30) .height(0).left().fill(); interactionTable.row(); interactionTable.add(); menuChoicesTable = new Table().top().left(); interactionTable.add(menuChoicesTable); interactionTable.row(); interactionTable.add(); contentActorCell = interactionTable.add((Actor) null).expandY().fill(); interactionTable.row(); interactionTable.add(); buttonTable = new Table().bottom(); interactionTable.add(buttonTable).padLeft(60).padRight(60).padBottom(60).fill(); rootStack.add(interactionTable); // Layer 5 - left & right menu bar shadows tableL5 = new Table().top().left(); tableL5.add().width(300); tableL5.add(leftMenuBarShadow).expandY().fill(); tableL5.add().width(currentMenuBarState.getWidth() - 44); tableL5.add(rightMenuBarShadow).expandY().fill(); tableL5.setTouchable(Touchable.disabled); rootStack.add(tableL5); addRootActor(rootStack); }
From source file:com.forerunnergames.peril.client.ui.screens.menus.MenuScreenWidgetFactory.java
License:Open Source License
public ImageTextButton createMenuChoice(final String choiceText, final EventListener listener) { Arguments.checkIsNotNullOrEmptyOrBlank(choiceText, "choiceText"); Arguments.checkIsNotNull(listener, "listener"); final ImageTextButton menuChoiceButton = new ImageTextButton(choiceText, createMenuChoiceStyle()); final Stack singlePlayerButtonStack = new Stack(); singlePlayerButtonStack.add(new Container<>(menuChoiceButton.getLabel()).left().padLeft(60)); singlePlayerButtonStack.add(menuChoiceButton.getImage()); menuChoiceButton.clearChildren();//from ww w .j a v a 2 s .c o m menuChoiceButton.add(singlePlayerButtonStack).fill().expand(); menuChoiceButton.addListener(listener); return menuChoiceButton; }
From source file:com.lyeeedar.UI.TabPanel.java
License:Apache License
private void initialize() { setTouchable(Touchable.enabled);/*from www.j a va 2 s.c o m*/ 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(leftCell.getActor().getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(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).expand().fill(); add(t).colspan(3).expand().fill(); }
From source file:com.packtpub.libgdx.canyonbunny.screens.MenuScreen.java
License:Apache License
private void rebuildStage() { skinCanyonBunny = new Skin(Gdx.files.internal(Constants.SKIN_CANYONBUNNY_UI), new TextureAtlas(Constants.TEXTURE_ATLAS_UI)); skinLibgdx = new Skin(Gdx.files.internal(Constants.SKIN_LIBGDX_UI), new TextureAtlas(Constants.TEXTURE_ATLAS_LIBGDX_UI)); // build all layers Table layerBackground = buildBackgroundLayer(); Table layerObjects = buildObjectsLayer(); Table layerLogos = buildLogosLayer(); Table layerControls = buildControlsLayer(); Table layerOptionsWindow = buildOptionsWindowLayer(); // assemble stage for menu screen stage.clear();//from w w w . j a v a2 s .c o m Stack stack = new Stack(); stage.addActor(stack); stack.setSize(Constants.VIEWPORT_GUI_WIDTH, Constants.VIEWPORT_GUI_HEIGHT); stack.add(layerBackground); stack.add(layerObjects); stack.add(layerLogos); stack.add(layerControls); stage.addActor(layerOptionsWindow); }