com.badlogic.gdx.scenes.scene2d.ui.Label Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Label. 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: CharacterScreen.java    From xibalba with MIT License 6 votes vote down vote up
private void updateSkillsGroup() {
  skillsGroup.clear();

  skillsGroup.addActor(new Label("Skills", Main.skin));
  skillsGroup.addActor(new Label("", Main.skin));

  for (Map.Entry<String, Integer> entry : skills.levels.entrySet()) {
    String skill = entry.getKey();
    Integer level = entry.getValue();

    if (level > 0) {
      String name = WordUtils.capitalize(skill);

      skillsGroup.addActor(new Label(
          "[LIGHT_GRAY]" + name + " [WHITE]" + level + "[DARK_GRAY]d", Main.skin
      ));
    }
  }
}
 
Example #2
Source File: TutorialMessageWindow.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@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: SelectBoxWidget.java    From talos with Apache License 2.0 6 votes vote down vote up
@Override
public Actor getSubWidget() {
    selectBox = new SelectBox<>(TalosMain.Instance().UIStage().getSkin(), "propertyValue");
    noValueLabel = new Label("", TalosMain.Instance().UIStage().getSkin());
    noValueLabel.setAlignment(Align.right);
    stack = new Stack();
    stack.add(noValueLabel);
    stack.add(selectBox);

    noValueLabel.setVisible(false);

    listener = new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            String newValue = selectBox.getSelected();
            valueChanged(newValue);
        }
    };
    selectBox.addListener(listener);

    return stack;
}
 
Example #4
Source File: DropVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override public IFuture<Void> visualize(DroppedItem drop) {
    final Future<Void> future = new Future<Void>();

    Group group = new Group();
    Tile image = new Tile("item/" + drop.item.name);
    Label counter = new Label(String.valueOf(drop.count), Config.skin);
    counter.setSize(image.getWidth(), image.getHeight());
    counter.setAlignment(Align.right | Align.bottom);
    group.addActor(image);
    group.addActor(counter);
    group.setTransform(false);
    visualizer.viewController.notificationLayer.addActor(group);
    group.setPosition(drop.target.getX() * ViewController.CELL_SIZE, drop.target.getY() * ViewController.CELL_SIZE);
    group.addAction(Actions.parallel(
        Actions.moveBy(0, 30, 1f, Interpolation.fade),
        Actions.alpha(0, 1f, Interpolation.fade),
        Actions.delay(0.4f, Actions.run(new Runnable() {
            @Override public void run() {
                future.happen();
            }
        }))
    ));
    return future;
}
 
Example #5
Source File: ModuleListPopup.java    From talos with Apache License 2.0 6 votes vote down vote up
private void parseCategory(FilteredTree<String> tree, FilteredTree.Node parent, XmlReader.Element element) {
    Array<XmlReader.Element> categories = element.getChildrenByName("category");
    for(XmlReader.Element category: categories) {
        FilteredTree.Node categoryNode = new FilteredTree.Node(category.getAttribute("name"), new Label(category.getAttribute("name"), getSkin()));

        if(parent != null) parent.add(categoryNode);
        else tree.add(categoryNode);

        parseCategory(tree, categoryNode, category);
    }

    // get modules
    Array<XmlReader.Element> modules = element.getChildrenByName("module");
    for(XmlReader.Element module: modules) {
        FilteredTree.Node node = new FilteredTree.Node(module.getAttribute("name"), new Label(module.getAttribute("name"), getSkin()));
        nameToModuleClass.put(module.getAttribute("name"), module.getText());

        registerModule(module);

        if(parent != null) parent.add(node);
        else tree.add(node);
    }
}
 
Example #6
Source File: VectorFieldModuleWrapper.java    From talos with Apache License 2.0 6 votes vote down vote up
@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 #7
Source File: MultiplayerConnectMenu.java    From Cubes with MIT License 6 votes vote down vote up
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
 
Example #8
Source File: VerbUI.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
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 #9
Source File: Entry.java    From ingress-apk-mod with Apache License 2.0 6 votes vote down vote up
public static void PortalInfoDialog_onStatsTableCreated(PortalInfoDialog dialog, Table t) {
    Mod.portalInfoDialog = dialog;

    Label.LabelStyle style = Mod.skin.get("portal-stats", Label.LabelStyle.class);

    List<Cell> cells = new ArrayList<Cell>(t.getCells());
    t.clear();
    t.add((Actor) cells.get(0).getWidget()).left();
    t.add((Actor) cells.get(1).getWidget()).left().expandX();
    t.row();
    t.add((Actor) cells.get(3).getWidget()).left();
    t.add((Actor) cells.get(4).getWidget()).left().expandX();
    t.row();
    t.add(new Label("Keys:", style)).left();
    t.add(new Label(String.valueOf(InventoryUtils.getNumberOfPortalKeys(dialog.portalComponent)), style)).left().expandX();
    t.row();
    t.add(new Label("Dist.:", style)).left();
    t.add(portalInfoDistLabel = new Label("", style)).left().expandX();
}
 
Example #10
Source File: StringSpin.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
public StringSpin(int length, int letterWidth, String initialText) {
    ThesaurusData data = Config.thesaurus.getData("alphabet");
    labels = new Array<Label>(length);
    letters = String.valueOf(shuffleArray((data.en + " " + data.ru).toCharArray())).toUpperCase();
    Array<String> arr = new Array<String>(letters.length());
    arr.addAll(letters.split(""));

    String newLined = arr.toString("\n");
    String doubled = newLined + "\n" + newLined;
    Label.LabelStyle style = Config.skin.get("default", Label.LabelStyle.class);

    lineHeight = style.font.getLineHeight();

    for (int i = 0; i < length; i++) {
        addColumn(i, letterWidth, doubled);
    }
    setSize(letterWidth * length, lineHeight);
    setTextImmediately(initialText);
}
 
Example #11
Source File: HudRenderer.java    From xibalba with MIT License 6 votes vote down vote up
private void updateEnemyInfo() {
  if (playerDetails.lastHitEntity == null) {
    enemyInfo.clear();
  } else {
    AttributesComponent enemyAttributes
        = ComponentMappers.attributes.get(playerDetails.lastHitEntity);
    String name = enemyAttributes.name;

    if (enemyInfo.getChildren().size == 0) {
      enemyInfo.addActor(new Label(name, Main.skin));
      enemyInfo.addActor(new Label(createEntityHealth(playerDetails.lastHitEntity), Main.skin));
      enemyInfo.addActor(new Label(createEntityOxygen(playerDetails.lastHitEntity), Main.skin));
      enemyInfo.addActor(new Label(createEntityStatus(playerDetails.lastHitEntity), Main.skin));
    } else {
      Label enemyNameLabel = (Label) enemyInfo.getChildren().get(0);
      enemyNameLabel.setText(name);
      Label enemyHealthLabel = (Label) enemyInfo.getChildren().get(1);
      enemyHealthLabel.setText(createEntityHealth(playerDetails.lastHitEntity));
      Label enemyOxygenLabel = (Label) enemyInfo.getChildren().get(2);
      enemyOxygenLabel.setText(createEntityOxygen(playerDetails.lastHitEntity));
      Label enemyStatusLabel = (Label) enemyInfo.getChildren().get(3);
      enemyStatusLabel.setText(createEntityStatus(playerDetails.lastHitEntity));
    }
  }
}
 
Example #12
Source File: SingleplayerSaveDeleteMenu.java    From Cubes with MIT License 6 votes vote down vote up
public SingleplayerSaveDeleteMenu(final Save save) {
  title = new Label(Localization.get("menu.singleplayer.delete.title"), skin.get("title", Label.LabelStyle.class));
  text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
  delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
  back = MenuTools.getBackButton(this);

  text.setAlignment(Align.center);

  delete.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      ClientSaveManager.deleteSave(save);
      Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
      if (!(prev instanceof SingleplayerSavesMenu)) return;
      ((SingleplayerSavesMenu) prev).updateSavesList();
      Adapter.setMenu(prev);
    }
  });

  stage.addActor(title);
  stage.addActor(text);
  stage.addActor(delete);
  stage.addActor(back);
}
 
Example #13
Source File: DieMessageWindow.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override protected void initialize() {
    Table table = new Table(Config.skin);
    table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background"));
    label = new LocLabel("", ACTIVE);
    label.setWrap(true);
    label.setAlignment(Align.center);

    table.setTouchable(Touchable.disabled);

    Label tapToContinue = new LocLabel("tap-to-continue", INACTIVE);
    tapToContinue.setWrap(true);
    tapToContinue.setAlignment(Align.center);

    table.add(imageTable).padTop(6).row();
    table.add(label).width(100).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 #14
Source File: SystemProfilerGUI.java    From riiablo with Apache License 2.0 6 votes vote down vote up
public ProfilerRow(SystemProfiler profiler, Skin skin) {
  super();
  draw = new CheckBox("", skin);
  name = new Label("", skin, STYLE_SMALL);
  name.setEllipsis(true);
  max = label("", skin, Align.right);
  localMax = label("", skin, Align.right);
  avg = label("", skin, Align.right);
  add(draw);
  add(name).expandX().fillX();
  ;
  add(max).minWidth(MIN_LABEL_WIDTH);
  add(localMax).minWidth(MIN_LABEL_WIDTH);
  add(avg).minWidth(MIN_LABEL_WIDTH);

  if (profiler != null) init(profiler);
}
 
Example #15
Source File: LanguageSelector.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
private void show(String language) {
    idx = -1;
    int i = 0;
    for (String lang : languages) {
        if (lang.equals(language)) {
            idx = i;
            break;
        }
        i++;
    }
    if (idx == -1) {
        language = "en";
        idx = 0;
    }
    left.setDisabled(idx == 0);
    right.setDisabled(idx == languages.length - 1);
    Label target = languageToLabel.get(language);
    languagePane.scrollTo(target.getX(), target.getY(), target.getWidth(), target.getHeight());
    languagePane.updateVisualScroll();
}
 
Example #16
Source File: AddStateDialog.java    From gdx-soundboard with MIT License 6 votes vote down vote up
public AddStateDialog(final Stage stage, final Skin skin, final MusicEventManager eventManager) {

        super("Add State", skin);
        this.stage = stage;
        this.skin = skin;
        this.eventManager = eventManager;


        Table content = this.getContentTable();
        Label label = new Label("State name", skin);
        label.setAlignment(Align.left);
        content.add(label).left().fillX().expandX().row();

        eventName = new TextField("", skin);
        content.add(eventName).right().fillX().expandX().row();

        Table buttons = this.getButtonTable();
        buttons.defaults().fillX().expandX();
        
        this.button("Ok", true);
        this.button("Cancel", false);
        

        key(Keys.ENTER, true);
        key(Keys.ESCAPE, false);
    }
 
Example #17
Source File: CharacterScreen.java    From xibalba with MIT License 6 votes vote down vote up
private void updateEquipmentGroup() {
  equipmentGroup.clear();

  equipmentGroup.addActor(new Label("Equipment", Main.skin));
  equipmentGroup.addActor(new Label("", Main.skin));

  int index = 0;

  for (java.util.Map.Entry<String, Entity> slot : equipment.slots.entrySet()) {
    String key = WordUtils.capitalize(slot.getKey());
    Entity item = slot.getValue();

    if (!WorldManager.entityHelpers.hasDefect(player, "One arm")
        || !Objects.equals(slot.getKey(), "left hand")) {
      equipmentGroup.addActor(
          new Label(createEquipmentSlotText(index, key, item), Main.skin)
      );
    }

    index++;
  }
}
 
Example #18
Source File: SMoveTooltip.java    From Unlucky with MIT License 6 votes vote down vote up
public SMoveTooltip(Skin skin, Label.LabelStyle ls) {
    super("", skin);
    this.ls = ls;

    desc = new Label("", skin);
    desc.setFontScale(0.5f);
    this.getTitleLabel().setFontScale(0.5f);
    left();
    // fix padding because of scaling
    this.padTop(12);
    this.padLeft(2);
    this.padBottom(4);
    add(desc);
    pack();
    this.setTouchable(Touchable.disabled);
    this.setVisible(false);
    this.setMovable(false);
    this.setOrigin(Align.bottomLeft);
}
 
Example #19
Source File: AbilityIconCounter.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
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 #20
Source File: FlopsyScreen.java    From flopsydroid with Apache License 2.0 6 votes vote down vote up
public FlopsyScreen(FlopsyDroidGame game, OnGlobalListener listener) {
    mStage = new Stage();

    mGlobalListener = listener;

    game.getAssetManager().load("flopsy.sprites", TextureAtlas.class);
    game.getAssetManager().finishLoading();
    mTextureAtlas = game.getAssetManager().get("flopsy.sprites", TextureAtlas.class);

    mLabelStyle = new Label.LabelStyle();
    mLabelStyle.font = new BitmapFont(Gdx.files.internal("flappyfont.fnt"),
            Gdx.files.internal("flappyfont.png"), false);

    mStage.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {

            if(event.getTarget().equals(mAndy)) {
                mGround.onDroidCollision();
                return true;
            }

            return false;
        }
    });
}
 
Example #21
Source File: SteeringTestBase.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
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 #22
Source File: YouScreen.java    From xibalba with MIT License 6 votes vote down vote up
private void updateDefectsGroup() {
  defectsGroup.clear();

  defectsGroup.addActor(new Label("Defects", Main.skin));
  defectsGroup.addActor(new Label("", Main.skin));

  Label instructions = new Label(
      WordUtils.wrap(
          "[DARK_GRAY]Taking a major defect gives you 2 points, taking a minor gives you 1", 70
      ), Main.skin
  );

  defectsGroup.addActor(instructions);
  defectsGroup.addActor(new Label("", Main.skin));

  for (int i = 0; i < this.defects.size(); i++) {
    DefectData defectData = this.defects.get(i);

    defectsGroup.addActor(
        new Label(createDefectText(i, defectData), Main.skin)
    );
  }
}
 
Example #23
Source File: Band.java    From Klooni1010 with GNU General Public License v3.0 6 votes vote down vote up
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 #24
Source File: GodScreen.java    From xibalba with MIT License 6 votes vote down vote up
private void updateGodsGroup() {
  godsGroup.clear();

  godsGroup.addActor(new Label("Gods", Main.skin));
  godsGroup.addActor(new Label("", Main.skin));

  for (int i = 0; i < godDataList.size(); i++) {
    GodData godData = godDataList.get(i);

    String string;

    if (i == godSelected) {
      string = "[DARK_GRAY]> [WHITE]" + godData.name + "\n[DARK_GRAY]" + godData.description;
    } else {
      string = "[LIGHT_GRAY]" + godData.name + "\n[DARK_GRAY]" + godData.description;
    }

    godsGroup.addActor(new Label(string, Main.skin));
  }
}
 
Example #25
Source File: Message.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public static void init(Skin skin) {
	msg = new Label("", skin, "message") {

		@Override
		public Actor hit(float x, float y, boolean touchable) {
			if (isModal)
				return this;

			return null;
		}
	};

	Message.skin = skin;
	msg.setWrap(true);
	msg.setAlignment(Align.center, Align.center);
}
 
Example #26
Source File: ScaleSelector.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
private void show(int scale) {
    idx = -1;
    int i = 0;
    for (int s : scales) {
        if (s == scale) {
            idx = i;
            break;
        }
        i++;
    }
    if (idx == -1) {
        scale = min;
        idx = 0;
    }
    left.setDisabled(idx == 0);
    right.setDisabled(idx == scales.length - 1);
    Label target = scaleToLabel.get(scale);
    scalePane.scrollTo(target.getX(), target.getY(), target.getWidth(), target.getHeight());
    scalePane.updateVisualScroll();
}
 
Example #27
Source File: LanguageSelector.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
private void scroll(int delta) {
    idx += delta;
    idx = MathUtils.clamp(idx, 0, languages.length - 1);
    String lang = languages[idx];
    Config.preferences.setLanguage(lang);
    left.setDisabled(idx == 0);
    right.setDisabled(idx == languages.length - 1);
    Label target = languageToLabel.get(lang);
    languagePane.scrollTo(target.getX(), target.getY(), target.getWidth(), target.getHeight(), true, true);
}
 
Example #28
Source File: StatusBar.java    From ninja-rabbit with GNU General Public License v2.0 5 votes vote down vote up
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 #29
Source File: StringSpin.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public void setTextImmediately(String text) {
    for (int i = 0; i < labels.size; i++) {
        String letter = i < text.length() ? String.valueOf(text.charAt(i)).toUpperCase() : " ";
        int idx = letters.indexOf(letter.toUpperCase());
        if (idx == -1) idx = letters.indexOf(" ");
        if (idx == -1) throw new IllegalStateException();
        Label label = labels.get(i);
        label.clearActions();
        label.setY(-(letters.length() - idx - 1) * lineHeight);
    }
}
 
Example #30
Source File: SlotTooltip.java    From libgdx-utils with MIT License 5 votes vote down vote up
@Override
public void hasChanged(Slot slot) {
	if (slot.isEmpty()) {
		setVisible(false);
		return;
	}

	// title displays the amount
	setTitle(slot.getAmount() + "x " + slot.getItem());
	clear();
	Label label = new Label("Super awesome description of " + slot.getItem(), skin);
	add(label);
	pack();
}