List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Label getStyle
public LabelStyle getStyle()
From source file:com.badlogic.gdx.ai.tests.btree.BehaviorTreeTestBase.java
License:Apache License
protected void addSeparator(Table table) { Label lbl = new Label("", container.skin); lbl.setColor(0.75f, 0.75f, 0.75f, 1); lbl.setStyle(new LabelStyle(lbl.getStyle())); lbl.getStyle().background = container.skin.newDrawable("white"); table.add(lbl).colspan(2).height(1).width(220).pad(5, 1, 5, 1); }
From source file:com.lyeeedar.Roguelike3D.Game.GameData.java
License:Open Source License
public static Label getRarityLabel(int i, Skin skin) { Rarity r = getRarity(i);//from w w w .j a v a2s.co m Label l = new Label("" + r, skin); LabelStyle ls = l.getStyle(); LabelStyle nls = new LabelStyle(); nls.fontColor = r.getColour(); nls.background = ls.background; nls.font = ls.font; l.setStyle(nls); return l; }
From source file:com.lyeeedar.Roguelike3D.Game.Item.Equippable.java
License:Open Source License
public Table getComparison(float a, float b, Skin skin, boolean reverse) { Table table = new Table(); table.add(new Label("" + a + ">", skin)); Label l = new Label("" + b, skin); LabelStyle ls = l.getStyle(); LabelStyle nls = new LabelStyle(); nls.fontColor = (a == b) ? new Color(1.0f, 1.0f, 1.0f, 1.0f) : (reverse) ? (a > b) ? new Color(0.3f, 0.8f, 0.3f, 1.0f) : new Color(0.8f, 0.3f, 0.3f, 1.0f) : (a < b) ? new Color(0.3f, 0.8f, 0.3f, 1.0f) : new Color(0.8f, 0.3f, 0.3f, 1.0f); nls.background = ls.background;/*w w w . j a v a2 s . co m*/ nls.font = ls.font; l.setStyle(nls); table.add(l); return table; }
From source file:com.lyeeedar.Roguelike3D.Game.Item.Equippable.java
License:Open Source License
public Table getComparison(int a, int b, Skin skin, boolean reverse) { Table table = new Table(); table.add(new Label("" + a + ">", skin)); Label l = new Label("" + b, skin); LabelStyle ls = l.getStyle(); LabelStyle nls = new LabelStyle(); nls.fontColor = (a == b) ? new Color(1.0f, 1.0f, 1.0f, 1.0f) : (reverse) ? (a > b) ? new Color(0.3f, 0.8f, 0.3f, 1.0f) : new Color(0.8f, 0.3f, 0.3f, 1.0f) : (a < b) ? new Color(0.3f, 0.8f, 0.3f, 1.0f) : new Color(0.8f, 0.3f, 0.3f, 1.0f); nls.background = ls.background;/*from w w w . j a v a2 s . c om*/ nls.font = ls.font; l.setStyle(nls); table.add(l); return table; }
From source file:com.packtpub.libgdx.canyonbunny.screens.MenuScreen.java
License:Apache License
private Table buildOptWinButtons() { Table tbl = new Table(); // + Separator Label lbl = null; lbl = new Label("", skinLibgdx); lbl.setColor(0.75f, 0.75f, 0.75f, 1); lbl.setStyle(new LabelStyle(lbl.getStyle())); lbl.getStyle().background = skinLibgdx.newDrawable("white"); tbl.add(lbl).colspan(2).height(1).width(220).pad(0, 0, 0, 1); tbl.row();/*from ww w . ja va 2 s. co m*/ lbl = new Label("", skinLibgdx); lbl.setColor(0.5f, 0.5f, 0.5f, 1); lbl.setStyle(new LabelStyle(lbl.getStyle())); lbl.getStyle().background = skinLibgdx.newDrawable("white"); tbl.add(lbl).colspan(2).height(1).width(220).pad(0, 1, 5, 0); tbl.row(); // + Save Button with event handler btnWinOptSave = new TextButton("Save", skinLibgdx); tbl.add(btnWinOptSave).padRight(30); btnWinOptSave.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { onSaveClicked(); } }); // + Cancel Button with event handler btnWinOptCancel = new TextButton("Cancel", skinLibgdx); tbl.add(btnWinOptCancel); btnWinOptCancel.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { onCancelClicked(); } }); return tbl; }
From source file:com.wotf.game.GuiStage.java
/** * Updates the GUI//from w w w . j a v a2 s .c om * Handles the time displays, game over state and the weapon hotbar */ public void update() { // update the turn and total time updateTime(); // weapon selector update mechanism int indexWeapon = 0; // // if (game.getTurnLogic().getState() != TurnLogic.TurnState.WITHDRAW) { // indexWeapon = WEAPONS_ARMORY.indexOf(game.getActiveTeam().getActiveUnit().getWeapon()); // } updateSelectedWeaponHotbar(indexWeapon); Label healthBarLabel = healthBarLabels.get(game.getActiveTeam()); // flashes active team to white and back to its original colour if (game.getTurnLogic().getElapsedTime() % 2 == 1) { healthBarLabel.getStyle().fontColor = Color.WHITE; } else { healthBarLabel.getStyle().fontColor = game.getActiveTeam().getColor(); } // if the turnstate is set to game over and the gameOver state hasn't been set if (game.getTurnLogic().getState() == TurnLogic.TurnState.GAMEOVER && !gameOver) { // show the game over message and set the gui status to game over showGameOverMessage(); gameOver = true; } // when the turnstate gets set to withdraw, it means a new turn is starting soon if (game.getTurnLogic().getState() == TurnLogic.TurnState.WITHDRAW) { turnStarting = true; } // at the beginning of a turn, we want to update the wind indicator to show the new wind if (turnStarting && game.getTurnLogic().getState() == TurnLogic.TurnState.PLAYING) { turnStarting = false; updateWind(); } // scrolls the wind indicators to indicate movement in this direction leftWindRegion.scroll(0.05f, 0); rightWindRegion.scroll(-0.05f, 0); }
From source file:de.fgerbig.spacepeng.screens.CreditsScreen.java
License:Open Source License
@Override public void show() { super.show(); // retrieve the default table actor Table table = super.getTable(); table.setSkin(game.getSkin());/*from w w w.j a v a 2 s . c om*/ Label label = new Label("Credits", game.getSkin()); label.setStyle(labelStyle_Heading); table.add(label).spaceBottom(25); table.row(); Label creditsText = new Label(CREDITS, game.getSkin()); Label.LabelStyle labelStyle = creditsText.getStyle(); labelStyle.font = game.getFont(); creditsText.setStyle(labelStyle); creditsText.setAlignment(Align.center); ScrollPane scrollPane = new ScrollPane(creditsText); table.add(scrollPane).size(CREDITS_WIDTH, CREDITS_HEIGHT).spaceBottom(25); table.row(); // register the back button TextButton backButton = new TextButton("Back", game.getSkin()); backButton.setStyle(textButtonStyle_Default); backButton.addListener(new DefaultInputListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { super.touchUp(event, x, y, pointer, button); SpacePeng.soundManager.play(SoundKey.CLICK); game.setScreen(new MenuScreen(game)); } }); table.row(); table.add(backButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).colspan(3); }
From source file:de.longri.cachebox3.gui.help.GestureHelp.java
License:Open Source License
@Override public void pack() { super.pack(); if (this.hasChildren()) return; // table is created int colNum = 5, rowNum = 5; int cellCount = 0; for (int row = 0; row < rowNum; row++) { for (int col = 0; col < colNum; col++) { cellCount++;/*from w ww . j a v a2 s . co m*/ switch (cellCount) { case 3: if (gestureUpIcon != null) table.add(new Image(gestureUpIcon)); else table.add(new Label("", VisUI.getSkin())); break; case 8: if (gestureUpIcon != null) { arrowUp = getArrowImageRotated(0); table.add(arrowUp); } else table.add(new Label("", VisUI.getSkin())); break; case 11: if (gestureLeftIcon != null) table.add(new Image(gestureLeftIcon)); else table.add(new Label("", VisUI.getSkin())); break; case 12: if (gestureLeftIcon != null) { arrowLeft = getArrowImageRotated(90); table.add(arrowLeft); } else table.add(new Label("", VisUI.getSkin())); break; case 13: table.add(new Image(buttonDrawable)); break; case 14: if (gestureRightIcon != null) { arrowRight = getArrowImageRotated(-90); table.add(arrowRight); } else table.add(new Label("", VisUI.getSkin())); break; case 15: if (gestureRightIcon != null) table.add(new Image(gestureRightIcon)); else table.add(new Label("", VisUI.getSkin())); break; case 18: if (gestureDownIcon != null) { arrowDown = getArrowImageRotated(180); table.add(arrowDown); } else table.add(new Label("", VisUI.getSkin())); break; case 23: if (gestureDownIcon != null) table.add(new Image(gestureDownIcon)); else table.add(new Label("", VisUI.getSkin())); break; default: table.add(new Label("", VisUI.getSkin())); } } table.row(); } table.pack(); table.setPosition((Gdx.graphics.getWidth() - table.getWidth()) / 2, (Gdx.graphics.getHeight() - table.getHeight()) / 2); this.addActor(table); // add label Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = this.style.font; labelStyle.fontColor = this.style.fontColor; Label label = new Label("", labelStyle); label.setWrap(true); label.setAlignment(Align.center, Align.center); float width = Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2; label.setWidth(width); GlyphLayout bounds = label.getStyle().font.newFontCache().setText(GESTURE_MSG, 0, 0, width, 0, true); label.setText(GESTURE_MSG); label.setPosition(CB.scaledSizes.MARGIN, Gdx.graphics.getHeight() - (bounds.height + CB.scaledSizes.MARGINx2)); this.addActor(label); TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle(); buttonStyle.font = this.style.font; buttonStyle.fontColor = this.style.fontColor; buttonStyle.up = new ColorDrawable(this.style.backgroundColor); TextButton button = new TextButton(DONT_SHOW_AGAIN_MSG, buttonStyle); button.setPosition(CB.scaledSizes.MARGIN, this.ellipseRectangle.getMaxY() + CB.scaledSizes.MARGINx2); button.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { log.debug("click on don't show again"); Config.showGestureHelp.setValue(false); Config.AcceptChanges(); //close directly hide(); } }); this.addActor(button); }
From source file:es.eucm.ead.editor.control.actions.editor.AddLabel.java
License:Open Source License
private void addText(Label label, boolean keepStyle) { Skin skin = controller.getEditorGameAssets().getSkin(); if (!keepStyle) { setDefaultFont(label);/*www. j a v a 2s.com*/ } LabelStyle labelStyle = skin.get(label.getStyle(), LabelStyle.class); glyphLayout.setText(labelStyle.font, label.getText()); ModelEntity textLabel = Q.createCenteredEntity(glyphLayout.width * .5f, glyphLayout.height * .5f, label); controller.action(AddSceneElement.class, textLabel); }
From source file:es.eucm.ead.editor.control.actions.model.ChangeSelectionText.java
License:Open Source License
@Override public Command perform(Object... args) { ModelEntity element = (ModelEntity) controller.getModel().getSelection().getSingle(Selection.SCENE_ELEMENT); Label label = Q.getComponent(element, Label.class); Skin skin = controller.getEditorGameAssets().getSkin(); LabelStyle newLabelStyle = skin.get(label.getStyle(), LabelStyle.class); String newText = label.getText(); CompositeCommand command = new CompositeCommand(); if (args.length == 1) { if (args[0] instanceof Color) { Color color = (Color) args[0]; es.eucm.ead.schema.data.Color schemaColor = new es.eucm.ead.schema.data.Color(); schemaColor.setR(color.r);/*from w w w . ja v a 2 s. c om*/ schemaColor.setG(color.g); schemaColor.setB(color.b); schemaColor.setA(color.a); return new FieldCommand(label, FieldName.COLOR, schemaColor); } else { newText = args[0].toString(); command.addCommand(new FieldCommand(label, FieldName.TEXT, newText)); } } else { if ((Boolean) args[1]) { newText = args[0].toString(); command.addCommand(new FieldCommand(label, FieldName.TEXT, newText)); } else { newLabelStyle = skin.get(args[0].toString(), LabelStyle.class); command.addCommand(new FieldCommand(label, FieldName.STYLE, args[0].toString())); } } // Actualize origin glyphLayout.setText(newLabelStyle.font, newText); command.addCommand(new FieldCommand(element, FieldName.ORIGIN_X, glyphLayout.width * 0.5f)); command.addCommand(new FieldCommand(element, FieldName.ORIGIN_Y, glyphLayout.height * 0.5f)); return command; }