List of usage examples for com.badlogic.gdx.utils Align bottomLeft
int bottomLeft
To view the source code for com.badlogic.gdx.utils Align bottomLeft.
Click Source Link
From source file:com.agateau.ui.UiBuilder.java
License:Apache License
private static int parseAlign(XmlReader.Element element) { String alignText = element.getAttribute("align", ""); if (alignText.isEmpty()) { return -1; }//from www. j a v a 2s . c o m if (alignText.equals("center")) { return Align.center; } else if (alignText.equals("centerLeft")) { return Align.left; } else if (alignText.equals("centerRight")) { return Align.right; } else if (alignText.equals("topLeft")) { return Align.topLeft; } else if (alignText.equals("topCenter")) { return Align.top; } else if (alignText.equals("topRight")) { return Align.topRight; } else if (alignText.equals("bottomLeft")) { return Align.bottomLeft; } else if (alignText.equals("bottomCenter")) { return Align.bottom; } else if (alignText.equals("bottomRight")) { return Align.bottomRight; } else { throw new RuntimeException("Unknown value of 'align': " + alignText); } }
From source file:com.forerunnergames.peril.client.ui.screens.menus.modes.classic.creategame.ClassicGameModeCreateGameMenuScreen.java
License:Open Source License
public ClassicGameModeCreateGameMenuScreen(final MenuScreenWidgetFactory widgetFactory, final ScreenChanger screenChanger, final ScreenSize screenSize, final MouseInput mouseInput, final Batch batch, final CountryCounter countryCounter, final MBassador<Event> eventBus) { super(widgetFactory, screenChanger, screenSize, mouseInput, batch, eventBus); Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); Arguments.checkIsNotNull(countryCounter, "countryCounter"); this.widgetFactory = widgetFactory; this.countryCounter = countryCounter; errorDialog = createErrorDialog();/* w ww . j a v a 2 s . c om*/ addTitle(TITLE_TEXT, Align.bottomLeft, 40); addSubTitle(SUBTITLE_TEXT); playerNameTextField = widgetFactory.createPlayerNameTextField(); clanAcronymTextField = widgetFactory.createClanAcronymTextField(); serverNameTextField = widgetFactory.createServerNameTextField(); clanAcronymCheckBox = widgetFactory.createClanAcronymCheckBox(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { clanAcronymTextField.setText(clanAcronymCheckBox.isChecked() ? clanAcronymTextField.getText() : ""); clanAcronymTextField.setDisabled(!clanAcronymCheckBox.isChecked()); } }); clanAcronymCheckBox.setChecked(!clanAcronymTextField.getText().isEmpty()); clanAcronymTextField.setDisabled(!clanAcronymCheckBox.isChecked()); // @formatter:off humanPlayerLimitLabel = widgetFactory .createPlayerLimitLabel(String.valueOf(InputSettings.INITIAL_CLASSIC_MODE_HUMAN_PLAYER_LIMIT)); aiPlayerLimitLabel = widgetFactory .createPlayerLimitLabel(String.valueOf(InputSettings.INITIAL_CLASSIC_MODE_AI_PLAYER_LIMIT)); playMapNameLabel = widgetFactory.createPlayMapNameLabel(); totalCountryCount = calculateCurrentPlayMapTotalCountryCount(); // @formatter:on customizeHumanPlayersButton = widgetFactory .createCustomizePlayersButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { // TODO Show Players Dialog. updateHumanPlayerLimit(); updateWinPercentSelectBoxItems(); } }); customizeAiPlayersButton = widgetFactory .createCustomizePlayersButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { // TODO Show Players Dialog. updateAiPlayerLimit(); updateWinPercentSelectBoxItems(); } }); customizePlayMapButton = widgetFactory.createCustomizePlayMapButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { // TODO Show Play Map Dialog. // TODO Add refresh button to Play Map Dialog to re-load play maps. playMaps = loadPlayMaps(); currentPlayMap = nextPlayMap(); playMapNameLabel.setText(currentPlayMap.getName()); totalCountryCount = calculateCurrentPlayMapTotalCountryCount(); updateWinPercentSelectBoxItems(); } }); // @formatter:off spectatorLimitSelectBox = widgetFactory.createSpectatorsSelectBox(); final Array<Integer> spectatorLimits = new Array<>( ClassicGameRules.MAX_SPECTATORS - ClassicGameRules.MIN_SPECTATORS + 1); for (int i = ClassicGameRules.MIN_SPECTATORS; i <= ClassicGameRules.MAX_SPECTATORS; ++i) { spectatorLimits.add(i); } spectatorLimitSelectBox.setItems(spectatorLimits); spectatorLimitSelectBox.setSelected(InputSettings.INITIAL_SPECTATOR_LIMIT); // @formatter:off // @formatter:on initialCountryAssignmentSelectBox = widgetFactory.createInitialCountryAssignmentSelectBox(); final Array<String> initialCountryAssignments = new Array<>(InitialCountryAssignment.count()); for (final InitialCountryAssignment initialCountryAssignment : InitialCountryAssignment.values()) { initialCountryAssignments.add(Strings.toProperCase(initialCountryAssignment.name())); } initialCountryAssignmentSelectBox.setItems(initialCountryAssignments); initialCountryAssignmentSelectBox .setSelected(Strings.toProperCase(InputSettings.INITIAL_CLASSIC_MODE_COUNTRY_ASSIGNMENT.name())); // @formatter:on winPercentSelectBox = widgetFactory.createWinPercentSelectBox(); updateWinPercentSelectBoxItems(); selectInitialWinPercentItem(); // @formatter:off playerSettingsSectionTitleLabel = widgetFactory.createPlayerSettingsSectionTitleLabel(); playerNameSettingLabel = widgetFactory.createPlayerNameSettingLabel(); clanTagSettingLabel = widgetFactory.createClanTagSettingLabel(); gameSettingsSectionTitleLabel = widgetFactory.createGameSettingsSectionTitleLabel(); serverNameSettingLabel = widgetFactory.createMenuSettingLabel(SERVER_NAME_SETTING_LABEL_TEXT); humanPlayerLimitSettingLabel = widgetFactory.createMenuSettingLabel(HUMAN_PLAYERS_SETTING_LABEL_TEXT); aiPlayerLimitSettingLabel = widgetFactory.createMenuSettingLabel(AI_PLAYERS_SETTING_LABEL_TEXT); spectatorLimitSettingLabel = widgetFactory.createMenuSettingLabel(SPECTATORS_SETTING_SETTING_LABEL_TEXT); playMapSettingLabel = widgetFactory.createMenuSettingLabel(PLAY_MAP_SETTING_LABEL_TEXT); winPercentSettingLabel = widgetFactory.createMenuSettingLabel(WIN_PERCENT_SETTING_LABEL_TEXT); initialCountryAssignmentSettingLabel = widgetFactory .createMenuSettingLabel(INITIAL_COUNTRY_ASSIGNMENT_SETTING_LABEL_TEXT); // @formatter:on final VerticalGroup verticalGroup = new VerticalGroup(); verticalGroup.align(Align.topLeft); final Table playerSettingsTable = new Table().top().left(); playerSettingsTable.add().height(23); playerSettingsTable.row(); playerSettingsTable.add(playerSettingsSectionTitleLabel).size(540, 40).fill().padLeft(60).left(); playerSettingsTable.row(); final Table playerNameTable = new Table(); playerNameTable.add(playerNameSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); playerNameTable.add(playerNameTextField).size(270, 28).fill().left().spaceLeft(10); playerSettingsTable.add(playerNameTable).left(); playerSettingsTable.row(); final Table clanTable = new Table(); clanTable.add(clanTagSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); clanTable.add(clanAcronymCheckBox).size(20, 20).fill().left().spaceLeft(10).spaceRight(8); clanTable.add(clanAcronymTextField).size(80, 28).fill().left().spaceLeft(8); playerSettingsTable.add(clanTable).left(); verticalGroup.addActor(playerSettingsTable); final Table gameSettingsTable = new Table().top().left(); gameSettingsTable.row(); gameSettingsTable.add().height(20); gameSettingsTable.row(); gameSettingsTable.add(gameSettingsSectionTitleLabel).size(540, 40).fill().padLeft(60).left(); gameSettingsTable.row(); final Table serverNameTable = new Table(); serverNameTable.add(serverNameSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); serverNameTable.add(serverNameTextField).size(270, 28).fill().left().spaceLeft(10); gameSettingsTable.add(serverNameTable).left(); gameSettingsTable.row(); final Table playMapTable = new Table(); playMapTable.add(playMapSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); playMapTable.add(playMapNameLabel).size(238, 28).fill().left().spaceLeft(10).spaceRight(4); playMapTable.add(customizePlayMapButton).size(28, 28).fill().left().spaceLeft(4); gameSettingsTable.add(playMapTable).left(); gameSettingsTable.row(); final Table humanPlayersTable = new Table(); humanPlayersTable.add(humanPlayerLimitSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); humanPlayersTable.add(humanPlayerLimitLabel).size(76, 28).fill().left().spaceLeft(10).spaceRight(4); humanPlayersTable.add(customizeHumanPlayersButton).size(28, 28).fill().left().spaceLeft(4); gameSettingsTable.add(humanPlayersTable).left(); gameSettingsTable.row(); final Table aiPlayersTable = new Table(); aiPlayersTable.add(aiPlayerLimitSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); aiPlayersTable.add(aiPlayerLimitLabel).size(76, 28).fill().left().spaceLeft(10).spaceRight(4); aiPlayersTable.add(customizeAiPlayersButton).size(28, 28).fill().left().spaceLeft(4); gameSettingsTable.add(aiPlayersTable).left(); gameSettingsTable.row(); final Table spectatorsTable = new Table(); spectatorsTable.add(spectatorLimitSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); spectatorsTable.add(spectatorLimitSelectBox).size(108, 28).fill().left().spaceLeft(10); gameSettingsTable.add(spectatorsTable).left(); gameSettingsTable.row(); final Table winPercentTable = new Table(); winPercentTable.add(winPercentSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); winPercentTable.add(winPercentSelectBox).size(108, 28).fill().left().spaceLeft(10); gameSettingsTable.add(winPercentTable).left(); gameSettingsTable.row(); // @formatter:off final Table initialCountryAssignmentTable = new Table(); initialCountryAssignmentTable.add(initialCountryAssignmentSettingLabel).size(150, 40).fill().padLeft(90) .left().spaceRight(10); initialCountryAssignmentTable.add(initialCountryAssignmentSelectBox).size(108, 28).fill().left() .spaceLeft(10); gameSettingsTable.add(initialCountryAssignmentTable).left(); // @formatter:on verticalGroup.addActor(gameSettingsTable); addContent(verticalGroup); addBackButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { contractMenuBar(new Runnable() { @Override public void run() { toScreen(ScreenId.CLASSIC_GAME_MODE_MENU); } }); } }); forwardButton = addForwardButton(FORWARD_BUTTON_TEXT, new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { if (currentPlayMap.equals(PlayMapMetadata.NULL)) { errorDialog.setMessage(new DefaultMessage("Please select a valid map before continuing.")); errorDialog.show(); return; } final String playerName = playerNameTextField.getText(); if (!GameSettings.isValidPlayerNameWithoutClanTag(playerName)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid player name: \'{}\'\n\nValid player name rules:\n\n{}", playerName, GameSettings.VALID_PLAYER_NAME_DESCRIPTION))); errorDialog.show(); return; } final String clanAcronym = clanAcronymTextField.getText(); if (!clanAcronymTextField.isDisabled() && !GameSettings.isValidHumanClanAcronym(clanAcronym)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid clan tag: \'{}\'\n\nValid clan tag rules:\n\n{}", clanAcronym, GameSettings.VALID_CLAN_ACRONYM_DESCRIPTION))); errorDialog.show(); return; } final String playerNameWithOptionalClanTag = GameSettings .getHumanPlayerNameWithOptionalClanTag(playerName, clanAcronym); final int humanPlayerLimit = getHumanPlayerLimit(); final int aiPlayerLimit = getAiPlayerLimit(); final int spectatorLimit = getSpectatorLimit(); final int winPercent = winPercentSelectBox.getSelected(); final InitialCountryAssignment initialCountryAssignment = InitialCountryAssignment .valueOf(Strings.toCase(initialCountryAssignmentSelectBox.getSelected(), LetterCase.UPPER)); final PersonLimits personLimits = PersonLimits.builder().humanPlayers(humanPlayerLimit) .aiPlayers(aiPlayerLimit).spectators(spectatorLimit).build(); final GameRules gameRules = GameRulesFactory.create(GameMode.CLASSIC, personLimits, winPercent, totalCountryCount, initialCountryAssignment); final GameConfiguration gameConfig = new DefaultGameConfiguration(GameMode.CLASSIC, currentPlayMap, gameRules); final String serverName = serverNameTextField.getText(); if (!NetworkSettings.isValidServerName(serverName)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid server name: \'{}\'\n\nValid server name rules:\n\n{}", serverName, NetworkSettings.VALID_SERVER_NAME_DESCRIPTION))); errorDialog.show(); return; } toScreen(ScreenId.MENU_TO_PLAY_LOADING); // The menu-to-play loading screen is now active & can therefore receive events. publishAsync(new CreateGameEvent(serverName, gameConfig, playerNameWithOptionalClanTag)); } }); }
From source file:com.forerunnergames.peril.client.ui.screens.menus.modes.classic.joingame.ClassicGameModeJoinGameMenuScreen.java
License:Open Source License
public ClassicGameModeJoinGameMenuScreen(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"); this.widgetFactory = widgetFactory; errorDialog = createErrorDialog();// w w w .j a v a 2 s .c o m addTitle("JOIN GAME", Align.bottomLeft, 40); addSubTitle("CLASSIC MODE"); playerNameTextField = widgetFactory.createPlayerNameTextField(); clanAcronymTextField = widgetFactory.createClanAcronymTextField(); serverAddressTextField = widgetFactory.createServerAddressTextField(); clanAcronymCheckBox = widgetFactory.createClanAcronymCheckBox(new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { clanAcronymTextField.setText(clanAcronymCheckBox.isChecked() ? clanAcronymTextField.getText() : ""); clanAcronymTextField.setDisabled(!clanAcronymCheckBox.isChecked()); } }); clanAcronymCheckBox.setChecked(!clanAcronymTextField.getText().isEmpty()); clanAcronymTextField.setDisabled(!clanAcronymCheckBox.isChecked()); playerSettingsSectionTitleLabel = widgetFactory.createPlayerSettingsSectionTitleLabel(); playerNameSettingLabel = widgetFactory.createPlayerNameSettingLabel(); clanTagSettingLabel = widgetFactory.createClanTagSettingLabel(); gameSettingsSectionTitleLabel = widgetFactory.createGameSettingsSectionTitleLabel(); serverAddressSettingLabel = widgetFactory.createMenuSettingLabel("Server Address"); final VerticalGroup verticalGroup = new VerticalGroup(); verticalGroup.align(Align.topLeft); // @formatter:off final Table playerSettingsTable = new Table().top().left(); playerSettingsTable.add().height(23).colspan(5); playerSettingsTable.row(); playerSettingsTable.add(playerSettingsSectionTitleLabel).size(538, 42).fill().padLeft(60).padRight(60) .left().colspan(5); playerSettingsTable.row(); playerSettingsTable.add(playerNameSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); playerSettingsTable.add(playerNameTextField).size(204, 28).fill().left().colspan(3).spaceLeft(10); playerSettingsTable.add().expandX().fill(); playerSettingsTable.row(); playerSettingsTable.add(clanTagSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); playerSettingsTable.add(clanAcronymCheckBox).size(18, 18).fill().left().spaceLeft(10).spaceRight(10); playerSettingsTable.add(clanAcronymTextField).size(74, 28).fill().left().spaceLeft(10); playerSettingsTable.add().width(102).fill(); playerSettingsTable.add().expandX().fill(); verticalGroup.addActor(playerSettingsTable); // @formatter:on // @formatter:off final Table gameSettingsTable = new Table().top().left(); gameSettingsTable.row(); gameSettingsTable.add().height(18).colspan(3); gameSettingsTable.row(); gameSettingsTable.add(gameSettingsSectionTitleLabel).size(538, 42).fill().padLeft(60).padRight(60).left() .colspan(3); gameSettingsTable.row(); gameSettingsTable.add(serverAddressSettingLabel).size(150, 40).fill().padLeft(90).left().spaceRight(10); gameSettingsTable.add(serverAddressTextField).size(204, 28).fill().left().spaceLeft(10); gameSettingsTable.add().expandX().fill(); verticalGroup.addActor(gameSettingsTable); // @formatter:on addContent(verticalGroup); addBackButton(new ClickListener(Input.Buttons.LEFT) { @Override public void clicked(final InputEvent event, final float x, final float y) { contractMenuBar(new Runnable() { @Override public void run() { toScreen(ScreenId.CLASSIC_GAME_MODE_MENU); } }); } }); forwardButton = addForwardButton("JOIN GAME", new ChangeListener() { @Override public void changed(final ChangeEvent event, final Actor actor) { final String playerName = playerNameTextField.getText(); if (!GameSettings.isValidPlayerNameWithoutClanTag(playerName)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid player name: \'{}\'\n\nValid player name rules:\n\n{}", playerName, GameSettings.VALID_PLAYER_NAME_DESCRIPTION))); errorDialog.show(); return; } final String clanAcronym = clanAcronymTextField.getText(); if (!clanAcronymTextField.isDisabled() && !GameSettings.isValidHumanClanAcronym(clanAcronym)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid clan tag: \'{}\'\n\nValid clan tag rules:\n\n{}", clanAcronym, GameSettings.VALID_CLAN_ACRONYM_DESCRIPTION))); errorDialog.show(); return; } final String playerNameWithOptionalClanTag = GameSettings .getHumanPlayerNameWithOptionalClanTag(playerName, clanAcronym); final String serverAddress = serverAddressTextField.getText(); if (!NetworkSettings.isValidServerAddress(serverAddress)) { errorDialog.setMessage(new DefaultMessage( Strings.format("Invalid server address: \'{}\'\n\nValid server address rules:\n\n{}", serverAddress, NetworkSettings.VALID_SERVER_ADDRESS_DESCRIPTION))); errorDialog.show(); return; } toScreen(ScreenId.MENU_TO_PLAY_LOADING); // The menu-to-play loading screen is now active & can therefore receive events. publishAsync(new JoinGameEvent(playerNameWithOptionalClanTag, serverAddress)); } }); }
From source file:es.eucm.ead.editor.MokapApplicationListener.java
License:Open Source License
@Override protected void initialize() { super.initialize(); controller.getModel().addLoadListener(new UpdateSaveTaskAfterLoadUnload()); controller.action(OpenApplication.class); stage.setActionsRequestRendering(true); if (platform.isDebug()) { performance = new Label("", controller.getApplicationAssets().getSkin() .get(SkinConstants.STYLE_PERFORMANCE, LabelStyle.class)); performance.setTouchable(Touchable.disabled); performance.setAlignment(Align.bottomLeft); stage.addActor(performance);//from ww w .j a v a2 s. c om } }
From source file:halive.shootinoutside.game.hud.GameHUD.java
public void init() { table = new Table(); table.setSkin(skin);//from w ww.ja v a2 s.c o m table.setFillParent(true); //table.setDebug(true); Table weaponInfo = new Table(skin); weaponLabel = new Label("None", skin); HorizontalGroup weaponGroup = new HorizontalGroup(); weaponGroup.addActor(new Label("Selected Weapon: ", skin)); weaponGroup.addActor(weaponLabel); weaponGroup.align(Align.bottomLeft); HorizontalGroup ammoGroup = new HorizontalGroup(); ammoGroup.align(Align.bottomRight); ammoGroup.addActor(new Label("Clips: ", skin)); clipLabel = new Label("0", skin); ammoGroup.addActor(clipLabel); ammoGroup.addActor(new Label(" Ammo: ", skin)); ammoLabel = new Label("0/100", skin); ammoGroup.addActor(ammoLabel); weaponInfo.add(weaponGroup).pad(1).row(); weaponInfo.add(ammoGroup).pad(1).row(); Table timeInfo = new Table(skin); HorizontalGroup timeGroup = new HorizontalGroup(); timeGroup.align(Align.top); timeGroup.addActor(new Label("Time Left: ", skin)); timeLabel = new Label("0:0", skin); timeGroup.addActor(timeLabel); timeInfo.add(timeGroup).pad(1).row(); table.add(timeInfo).top().expand().row(); table.add(weaponInfo).bottom().left().expand().row(); this.addActor(table); }