Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Label#setAlignment()
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.Label#setAlignment() .
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: VectorFieldModuleWrapper.java From talos with Apache License 2.0 | 6 votes |
@Override protected void configureSlots () { addInputSlot("field position", VectorFieldModule.POSITION); addInputSlot("field size", VectorFieldModule.SIZE_SCALE); addInputSlot("field force", VectorFieldModule.FORCE_SCALE); addOutputSlot("velocity", VectorFieldModule.VELOCITY); addOutputSlot("angle", VectorFieldModule.ANGLE); leftWrapper.add().expandY().row(); rightWrapper.add().expandY().row(); vectorFieldLabel = new Label("drop .fga file here", getSkin()); vectorFieldLabel.setAlignment(Align.center); vectorFieldLabel.setWrap(true); contentWrapper.add(vectorFieldLabel).padTop(60f).padBottom(10f).size(180, 50).center().expand(); }
Example 2
Source File: TutorialMessageWindow.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
@Override protected void initialize() { Table table = new Table(Config.skin); table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background")); label = new LocLabel("", DieMessageWindow.ACTIVE); label.setWrap(true); label.setAlignment(Align.center); table.setTouchable(Touchable.disabled); Label tapToContinue = new LocLabel("tap-to-continue", DieMessageWindow.INACTIVE); tapToContinue.setWrap(true); tapToContinue.setAlignment(Align.center); if (image != null) { image.setTouchable(Touchable.disabled); table.add(image).padTop(-15 - dy).row(); } final Cell<LocLabel> cell = table.add(label).width(100); if (forceLabelHeight) cell.height(labelHeight); cell.row(); table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row(); table.add(tapToContinue).width(80).row(); this.table.add(table); }
Example 3
Source File: AbilityIconCounter.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
public AbilityIconCounter(Ability ability, int value) { if (ability == null) { ability = Config.abilities.get("skip-turn"); } image = new Image(Config.skin.getDrawable("ability/" + ability.name + "-icon")); if (ability.cost <0) image.setColor(AbilityIcon.unique); image.setScaling(Scaling.none); image.setAlign(Align.left | Align.top); image.moveBy(0, 1); counter = new Label("", Config.skin, "default", "inventory-counter"); counter.setAlignment(Align.right | Align.bottom); setCount(value); addActor(image); addActor(counter); setSize(image.getPrefWidth(), image.getPrefHeight()); }
Example 4
Source File: Band.java From Klooni1010 with GNU General Public License v3.0 | 6 votes |
public Band(final Klooni game, final GameLayout layout, final BaseScorer scorer) { this.scorer = scorer; bandTexture = Theme.getBlankTexture(); Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = game.skin.getFont("font"); scoreLabel = new Label("", labelStyle); scoreLabel.setAlignment(Align.center); infoLabel = new Label("pause menu", labelStyle); infoLabel.setAlignment(Align.center); scoreBounds = new Rectangle(); infoBounds = new Rectangle(); layout.update(this); }
Example 5
Source File: VerbUI.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public VerbUI(SceneScreen scn) { super(scn.getUI().getSkin()); style = scn.getUI().getSkin().get(VerbUIStyle.class); if (style.background != null) setBackground(style.background); this.sceneScreen = scn; infoLine = new Label(VERBS_DESC.get(VERBS.indexOf(DEFAULT_VERB)), style.infoLineLabelStyle); infoLine.setAlignment(Align.center); add(infoLine).colspan(3).fillX().expandX(); row(); Table verbs = createVerbPanel(); add(verbs).fill().expand(); arrowPanel = createArrowPanel(); add(arrowPanel).fillY().expandY(); invPanel = createInventoryPanel(); add(invPanel).fill().expand(); }
Example 6
Source File: InfoMenu.java From Cubes with MIT License | 5 votes |
public InfoMenu(String labelText, String buttonText) { super(); text = new Label(labelText, new LabelStyle(Fonts.hud, Color.WHITE)); text.setAlignment(Align.center, Align.center); button = new TextButton(buttonText, skin); stage.addActor(text); stage.addActor(button); }
Example 7
Source File: Scene2dUtils.java From gdx-soundboard with MIT License | 5 votes |
public static Label addLabel(String labelText, Table parent, Skin skin){ Label label = new Label(labelText, skin); label.setAlignment(Align.left); parent.add(label).left(); Label info = new Label("", skin); info.setAlignment(Align.right); parent.add(info).right().row(); return info; }
Example 8
Source File: Scene2dUtils.java From gdx-soundboard with MIT License | 5 votes |
public static TextField addTextField(String labelText, Table parent, Skin skin){ Label label = new Label(labelText, skin); label.setAlignment(Align.left); parent.add(label).left(); TextField info = new TextField("", skin); parent.add(info).right().fillX().expandX().row(); return info; }
Example 9
Source File: DialogLoading.java From skin-composer with MIT License | 5 votes |
public void populate() { Table t = getContentTable(); Label label = new Label("Loading...", main.getSkin(), "title"); label.setAlignment(Align.center); t.add(label); t.row(); Table table = new Table(main.getSkin()); table.setBackground(main.getLoadingAnimation()); t.add(table); }
Example 10
Source File: MenuScreen.java From Unlucky with MIT License | 5 votes |
public MenuScreen(final Unlucky game, final ResourceManager rm) { super(game, rm); menuStyle = new Label.LabelStyle(rm.pixel10, new Color(79 / 255.f, 79 / 255.f, 117 / 255.f, 1)); // one for each letter titleMoves = new Moving[7]; letters = new Image[7]; for (int i = 0; i < 7; i++) { titleMoves[i] = new Moving(new Vector2(), new Vector2(), 0); letters[i] = new Image(rm.title[i]); stage.addActor(letters[i]); } handlePlayButton(); handleOptionButtons(); battleLabel = new Label("Battle", menuStyle); battleLabel.setSize(80, 40); battleLabel.setFontScale(1.5f); battleLabel.setTouchable(Touchable.disabled); battleLabel.setAlignment(Align.center); battleLabel.setPosition(60, 35); stage.addActor(battleLabel); createCreditsScreen(); // menu music rm.menuTheme.setLooping(true); rm.menuTheme.play(); }
Example 11
Source File: LabelWidget.java From talos with Apache License 2.0 | 5 votes |
@Override public Actor getSubWidget() { propertyValue = new Label("", TalosMain.Instance().getSkin()); propertyValue.setWidth(170); propertyValue.setEllipsis(true); propertyValue.setAlignment(Align.right); return propertyValue; }
Example 12
Source File: BaseScorer.java From Klooni1010 with GNU General Public License v3.0 | 5 votes |
BaseScorer(final Klooni game, GameLayout layout, int highScore) { cupTexture = SkinLoader.loadPng("cup.png"); cupColor = Klooni.theme.currentScore.cpy(); cupArea = new Rectangle(); Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = game.skin.getFont("font"); currentScoreLabel = new Label("0", labelStyle); currentScoreLabel.setAlignment(Align.right); highScoreLabel = new Label(Integer.toString(highScore), labelStyle); layout.update(this); }
Example 13
Source File: TimeScorer.java From Klooni1010 with GNU General Public License v3.0 | 5 votes |
public TimeScorer(final Klooni game, GameLayout layout) { super(game, layout, Klooni.getMaxTimeScore()); highScore = Klooni.getMaxTimeScore(); Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = game.skin.getFont("font"); timeLeftLabel = new Label("", labelStyle); timeLeftLabel.setAlignment(Align.center); layout.updateTimeLeftLabel(timeLeftLabel); startTime = TimeUtils.nanoTime(); deadTime = startTime + START_TIME; pausedTimeLeft = -1; }
Example 14
Source File: PropertyWidget.java From talos with Apache License 2.0 | 5 votes |
protected void build(String name) { if(name != null) { propertyName = new Label(name + ":", TalosMain.Instance().getSkin()); add(propertyName).left(); propertyName.setAlignment(Align.left); valueContainer = new Table(); add(valueContainer).right().expandX().minWidth(170); addToContainer(getSubWidget()); } else { add(getSubWidget()).growX(); } }
Example 15
Source File: ProfessionAbilityDescriptionWindow.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected void doShow(Params params) { Table content = new Table(Config.skin); content.defaults().pad(2); content.setBackground("ui-creature-info-background"); content.setTouchable(Touchable.enabled); table.add(content); Image image = new Image(Config.skin, "ability/" + params.ability.name + "-icon"); Image line = new Image(Config.skin, "ui-creature-info-line"); Thesaurus.Params dp = Thesaurus.params(); params.ability.fillDescriptionParams(dp, params.creature); Label desc = new LocLabel(params.ability.locDescKey(), dp); desc.setWrap(true); desc.setAlignment(Align.center); content.add(image).size(image.getWidth() * 2, image.getHeight() * 2).padBottom(-6).padTop(0).row(); content.add(new LocLabel(params.ability.locNameKey())).padBottom(3).row(); content.add(line).width(50).row(); content.add(desc).width(120).row(); if (!params.ability.requirement.isSatisfied(params.creature.description)) { Label label = new LocLabel(params.ability.requirement.describe(params.creature.description), StoreWindow.INACTIVE); label.setWrap(true); label.setAlignment(Align.center); content.add(label).padLeft(4).padRight(4).padBottom(3).width(120).row(); } }
Example 16
Source File: MenuTools.java From Cubes with MIT License | 4 votes |
public static void setTitle(Label label) { label.setBounds(0, GUI_HEIGHT / 6 * 5, GUI_WIDTH, GUI_HEIGHT / 6); label.setAlignment(Align.center, Align.center); }
Example 17
Source File: LevelUpScreen.java From Unlucky with MIT License | 4 votes |
public LevelUpScreen(GameScreen gameScreen, TileMap tileMap, Player player, ResourceManager rm) { super(gameScreen, tileMap, player, rm); // create bg ImageButton.ImageButtonStyle style = new ImageButton.ImageButtonStyle(); style.imageUp = new TextureRegionDrawable(rm.levelupscreen400x240); ui = new ImageButton(style); ui.setSize(200, 120); ui.setPosition(0, 0); ui.setTouchable(Touchable.disabled); stage.addActor(ui); handleClick(); // create animation levelUpAnim = new AnimationManager(rm.levelUp96x96, 4, 0, 1 / 4f); // create labels BitmapFont font = rm.pixel10; Label.LabelStyle titleFont = new Label.LabelStyle(font, new Color(0, 205 / 255.f, 20 / 255.f, 1)); Label.LabelStyle stdWhite = new Label.LabelStyle(font, new Color(1, 1, 1, 1)); Label.LabelStyle yellow = new Label.LabelStyle(font, new Color(1, 212 / 255.f, 0, 1)); Label.LabelStyle blue = new Label.LabelStyle(font, new Color(0, 190 / 255.f, 1, 1)); title = new Label("LEVEL UP!", titleFont); title.setSize(200, 20); title.setPosition(0, 95); title.setFontScale(2.5f); title.setAlignment(Align.center); title.setTouchable(Touchable.disabled); stage.addActor(title); levelDesc = new Label("You reached level 1", stdWhite); levelDesc.setSize(200, 20); levelDesc.setPosition(0, 80); levelDesc.setAlignment(Align.center); levelDesc.setTouchable(Touchable.disabled); stage.addActor(levelDesc); statsDescs = new Label[statNames.length]; stats = new Label[statNames.length]; increases = new Label[statNames.length]; for (int i = 0; i < statNames.length; i++) { statsDescs[i] = new Label(statNames[i], stdWhite); statsDescs[i].setSize(10, 10); statsDescs[i].setFontScale(1.3f / 2); statsDescs[i].setPosition(100, 17 + (i * 12)); statsDescs[i].setAlignment(Align.left); statsDescs[i].setTouchable(Touchable.disabled); stage.addActor(statsDescs[i]); stats[i] = new Label("1330", blue); stats[i].setSize(10, 10); stats[i].setFontScale(1.3f / 2); stats[i].setPosition(140, 17 + (i * 12)); stats[i].setAlignment(Align.left); stats[i].setTouchable(Touchable.disabled); stage.addActor(stats[i]); increases[i] = new Label("+20", yellow); increases[i].setSize(10, 10); increases[i].setFontScale(1.3f / 2); increases[i].setPosition(170, 17 + (i * 12)); increases[i].setAlignment(Align.left); increases[i].setTouchable(Touchable.disabled); stage.addActor(increases[i]); } clickToContinue = new Label("Click to continue", stdWhite); clickToContinue.setSize(200, 10); clickToContinue.setFontScale(0.5f); clickToContinue.setPosition(0, 2); clickToContinue.setAlignment(Align.center); clickToContinue.setTouchable(Touchable.disabled); stage.addActor(clickToContinue); }
Example 18
Source File: LoadSaveScreen.java From bladecoder-adventure-engine with Apache License 2.0 | 4 votes |
@Override public void clicked(InputEvent event, float x, float y) { final Actor listenerActor = event.getListenerActor(); Dialog d = new Dialog("", ui.getSkin()) { @Override protected void result(Object object) { if (((Boolean) object).booleanValue()) { final World world = ui.getWorld(); final String filename = listenerActor.getName() + WorldSerialization.GAMESTATE_EXT; try { world.removeGameState(filename); listenerActor.getParent().getParent().getParent() .removeActor(listenerActor.getParent().getParent()); } catch (IOException e) { EngineLogger.error(e.getMessage()); } } } }; d.pad(DPIUtils.getMarginSize()); d.getButtonTable().padTop(DPIUtils.getMarginSize()); d.getButtonTable().defaults().padLeft(DPIUtils.getMarginSize()).padRight(DPIUtils.getMarginSize()); Label l = new Label(ui.getWorld().getI18N().getString("ui.remove"), ui.getSkin(), "ui-dialog"); l.setWrap(true); l.setAlignment(Align.center); d.getContentTable().add(l).prefWidth(Gdx.graphics.getWidth() * .7f); d.button(ui.getWorld().getI18N().getString("ui.yes"), true, ui.getSkin().get("ui-dialog", TextButtonStyle.class)); d.button(ui.getWorld().getI18N().getString("ui.no"), false, ui.getSkin().get("ui-dialog", TextButtonStyle.class)); d.key(Keys.ENTER, true).key(Keys.ESCAPE, false); d.show(stage); }
Example 19
Source File: Main.java From graphicsfuzz with Apache License 2.0 | 4 votes |
@Override public void create() { if(this.overrideLogger != null){ Gdx.app.setApplicationLogger(overrideLogger); } // Only DesktopLauncher sets this. if(gl30 == null) { // Gdx.gl30 could also be null though. gl30 = Gdx.gl30; } Gdx.graphics.getGL20().glEnable(GL20.GL_TEXTURE_2D); Gdx.graphics.getGL20().glEnable(GL20.GL_DEPTH_TEST); Gdx.graphics.getGL20().glDepthFunc(GL20.GL_LESS); standardMesh = buildFullScreenQuadMesh(); if(standaloneRenderJob != null) { if (standaloneRenderJob.isSetComputeSource()) { updateState(WorkerState.COMPUTE_STANDALONE_PREPARE); } else { updateState(WorkerState.IMAGE_STANDALONE_PREPARE); } return; } PlatformInfoUtil.getPlatformDetails(platformInfoJson); PlatformInfoUtil.getGlVersionInfo(platformInfoJson, gl30); sanityReferenceImage = createPixelBuffer(); sanityCheckImage = createPixelBuffer(); sanityCheckImageTmp = createPixelBuffer(); GdxStage = new Stage(new ScreenViewport()); Label.LabelStyle label1Style = new Label.LabelStyle(); label1Style.font = new BitmapFont(); label1Style.fontColor = Color.WHITE; DisplayContent = new StringBuilder(); DisplayLabel = new Label(DisplayContent.toString(), label1Style); DisplayLabel.setPosition(WIDTH + DISPLAY_TXT_MARGIN, 0); DisplayLabel .setSize(Gdx.graphics.getWidth() - WIDTH - DISPLAY_TXT_MARGIN - 10, Gdx.graphics.getHeight() - 10); DisplayLabel.setAlignment(Align.topLeft); DisplayContent = new StringBuilder(); GdxStage.addActor(DisplayLabel); }
Example 20
Source File: ProfessionAbilityPlayWindow.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.setBackground("ui-creature-info-background"); content.setTouchable(Touchable.enabled); table.add(content); Image image = new Image(Config.skin, "ability/" + params.ability.name + "-icon"); Image line = new Image(Config.skin, "ui-creature-info-line"); TextButton use = new LocTextButton("ui-use-ability"); Thesaurus.Params dp = Thesaurus.params(); params.ability.fillDescriptionParams(dp, params.creature); Label desc = new LocLabel(params.ability.locDescKey(), dp); desc.setWrap(true); desc.setAlignment(Align.center); content.add(image).size(image.getWidth() * 2, image.getHeight() * 2).padBottom(-6).padTop(0).row(); content.add(new LocLabel(params.ability.locNameKey())).padBottom(3).row(); content.add(line).width(50).row(); content.add(desc).width(120).row(); content.add(use).padBottom(6).padTop(6).width(90).row(); Thesaurus.LocalizationData reason = new Thesaurus.LocalizationData(); if (!params.ability.action.canBeApplied(params.creature, reason)) { use.setDisabled(true); CooldownEffect cooldown = params.creature.get(Attribute.cooldownFor(params.ability.name)); LocLabel label; if (cooldown == null) { label = new LocLabel(reason.key, reason.params, StoreWindow.INACTIVE); } else { Thesaurus.Params p = Thesaurus.params() .with("desc", cooldown.locDescKey()) .with("turn-count", String.valueOf(cooldown.getTurnCount())) .with("die", params.creature.description.nameLocKey()); params.ability.fillDescriptionParams(p, params.creature); label = new LocLabel("ui-creature-info-window-effect-description", p, StoreWindow.INACTIVE); } label.setWrap(true); label.setAlignment(Align.center); content.add(label).padLeft(4).padRight(4).padBottom(3).width(120).row(); } else { use.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { doUse = true; hide(); } }); } }