com.badlogic.gdx.utils.Align Java Examples

The following examples show how to use com.badlogic.gdx.utils.Align. 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: 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 #2
Source File: ChatGUI.java    From Radix with MIT License 6 votes vote down vote up
@Override
public void onChatMessage(Message message) {
    if (message instanceof TranslationMessage) {
        TranslationMessage tmsg = (TranslationMessage)message;
        try {
            chatMessages.add(String.format("<%s> %s", tmsg.getTranslationParams()[0], tmsg.getTranslationParams()[1]));
        } catch (ArrayIndexOutOfBoundsException e) {
            e.printStackTrace();
            chatMessages.add(message.getFullText());
        }
    } else {
        chatMessages.add(message.getFullText());
    }

    StringBuilder messages = new StringBuilder();
    for(String s : chatMessages) {
        messages.append(s).append("\n");
    }
    fontCache.clear();
    chatAreaLayout = fontCache.addText(messages, 0, 0, 512, Align.left, true);
    fontCache.setPosition(4, chatAreaLayout.height + 50);
}
 
Example #3
Source File: MPQViewer.java    From riiablo with Apache License 2.0 6 votes vote down vote up
protected void drawDelegate(Batch batch, float a) {
  /*ShaderProgram s = null;
  if (shader != null && palette != null) {
    batch.flush();
    s = batch.getShader();
    batch.setShader(shader);

    palette.bind(1);
    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
    shader.setUniformi("ColorTable", 1);
  }*/

  drawable.draw(batch,
      getX(Align.center) - (drawable.getMinWidth() / 2),
      getY(Align.center) - (drawable.getMinHeight() / 2),
      drawable.getMinWidth(), drawable.getMinHeight());

  /*if (shader != null && palette != null) {
    batch.setShader(s);
  }*/
}
 
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: 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 #6
Source File: ParallelVsSequenceTest.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
protected void setRandomNonOverlappingPosition (SteeringActor character, Array<? extends SteeringActor> others,
	float minDistanceFromBoundary) {
	int maxTries = Math.max(100, others.size * others.size);
	SET_NEW_POS:
	while (--maxTries >= 0) {
		character.setPosition(MathUtils.random(stage.getWidth()), MathUtils.random(stage.getHeight()), Align.center);
		character.getPosition().set(character.getX(Align.center), character.getY(Align.center));
		for (int i = 0; i < others.size; i++) {
			SteeringActor other = (SteeringActor)others.get(i);
			if (character.getPosition().dst(other.getPosition()) <= character.getBoundingRadius() + other.getBoundingRadius()
				+ minDistanceFromBoundary) continue SET_NEW_POS;
		}
		return;
	}
	throw new GdxRuntimeException("Probable infinite loop detected");
}
 
Example #7
Source File: ZoomEffect.java    From gdx-vfx with Apache License 2.0 6 votes vote down vote up
/**
 * Specify the zoom origin in {@link Align} bits.
 * @see Align
 */
public void setOrigin(int align) {
    final float originX;
    final float originY;
    if ((align & Align.left) != 0) {
        originX = 0f;
    } else if ((align & Align.right) != 0) {
        originX = 1f;
    } else {
        originX = 0.5f;
    }
    if ((align & Align.bottom) != 0) {
        originY = 0f;
    } else if ((align & Align.top) != 0) {
        originY = 1f;
    } else {
        originY = 0.5f;
    }
    setOrigin(originX, originY);
}
 
Example #8
Source File: RadialBlurEffect.java    From gdx-vfx with Apache License 2.0 6 votes vote down vote up
/**
 * Specify the zoom origin in {@link Align} bits.
 * @see Align
 */
public void setOrigin(int align) {
    final float originX;
    final float originY;
    if ((align & Align.left) != 0) {
        originX = 0f;
    } else if ((align & Align.right) != 0) {
        originX = 1f;
    } else {
        originX = 0.5f;
    }
    if ((align & Align.bottom) != 0) {
        originY = 0f;
    } else if ((align & Align.top) != 0) {
        originY = 1f;
    } else {
        originY = 0.5f;
    }
    setOrigin(originX, originY);
}
 
Example #9
Source File: HotkeyButton.java    From riiablo with Apache License 2.0 6 votes vote down vote up
public HotkeyButton(final DC dc, final int index, int skillId, Stat chargedSkill) {
  super(new ButtonStyle() {{
    up       = new TextureRegionDrawable(dc.getTexture(index));
    down     = new TextureRegionDrawable(dc.getTexture(index + 1));
    disabled = up;
    pressedOffsetX = pressedOffsetY = -2;
  }});

  this.skillId = skillId;
  this.chargedSkill = chargedSkill;
  add(hotkey = new Label("", Riiablo.fonts.font16, Riiablo.colors.gold)).align(Align.topRight);
  row();
  add().grow();
  row();
  add(charges = new Label(chargedSkill != null ? Integer.toString(chargedSkill.value1()) : "", Riiablo.fonts.font16, Riiablo.colors.blue)).align(Align.bottomLeft);
  pad(2);
  pack();

  setDisabledBlendMode(BlendMode.DARKEN, Riiablo.colors.darkenRed);
}
 
Example #10
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 #11
Source File: ShareScoreScreen.java    From Klooni1010 with GNU General Public License v3.0 6 votes vote down vote up
ShareScoreScreen(final Klooni game, final Screen lastScreen,
                 final int score, final boolean timeMode) {
    this.game = game;
    this.lastScreen = lastScreen;

    this.score = score;
    this.timeMode = timeMode;

    final Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font_small");

    infoLabel = new Label("Generating image...", labelStyle);
    infoLabel.setColor(Klooni.theme.textColor);
    infoLabel.setAlignment(Align.center);
    infoLabel.layout();
    infoLabel.setPosition(
            (Gdx.graphics.getWidth() - infoLabel.getWidth()) * 0.5f,
            (Gdx.graphics.getHeight() - infoLabel.getHeight()) * 0.5f);

    spriteBatch = new SpriteBatch();
}
 
Example #12
Source File: Hud.java    From Unlucky with MIT License 6 votes vote down vote up
/**
 * Creates the level descriptor window
 */
private void createLevelDescriptor() {
    levelDescriptor = new Window("", rm.skin);
    levelDescriptor.getTitleLabel().setFontScale(0.5f);
    levelDescriptor.getTitleLabel().setAlignment(Align.center);
    levelDescriptor.setMovable(false);
    levelDescriptor.setTouchable(Touchable.disabled);
    levelDescriptor.setKeepWithinStage(false);
    levelDescriptor.setVisible(false);
    levelDesc = new Label("", new Label.LabelStyle(rm.pixel10, Color.WHITE));
    levelDesc.setFontScale(0.5f);
    levelDesc.setAlignment(Align.center);
    levelDescriptor.left();
    levelDescriptor.padTop(12);
    levelDescriptor.padLeft(2);
    levelDescriptor.padBottom(4);
    levelDescriptor.add(levelDesc).width(70);
    stage.addActor(levelDescriptor);
    levelMoving = new Moving(new Vector2(), new Vector2(), 150.f);
}
 
Example #13
Source File: PageGroup.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
private void spotlightRegion(RegionModel region) {
    if (this.region == region) return;

    this.region = region;
    active = true;

    // You can customize what is shown when a user hovers on region in here.
    final TextureAtlasData.Region regionData = region.getRegionData();
    final StringBuilder sb = new StringBuilder();
    sb.append(regionData.name);
    if (regionData.index >= 0) {
        sb.append("[#fbf236ff] idx:" + regionData.index);
    }

    font.getData().setScale(1f);
    glText.setText(font, sb.toString(), Color.WHITE, 0f, Align.left, false);
}
 
Example #14
Source File: DialogFactory.java    From skin-composer with MIT License 6 votes vote down vote up
public void showDeleteStyleDialog(Skin skin, Stage stage) {
    StyleData styleData = main.getRootTable().getSelectedStyle();

    Dialog dialog = new Dialog("Delete Style", skin, "bg") {
        @Override
        protected void result(Object object) {
            if ((Boolean) object) {
                main.getUndoableManager().addUndoable(new DeleteStyleUndoable(styleData, main), true);
            }
        }
    };
    dialog.getTitleLabel().setAlignment(Align.center);
    dialog.getContentTable().defaults().padLeft(10.0f).padRight(10.0f);
    dialog.text("Are you sure you want to delete style " + styleData.name + "?");
    dialog.getContentTable().getCells().first().pad(10.0f);

    dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
    dialog.button("Yes, delete the style", true).button("No", false);
    dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
    dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());

    dialog.key(Input.Keys.ENTER, true).key(Input.Keys.ESCAPE, false);

    dialog.show(stage);
}
 
Example #15
Source File: VisCheckBox.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
public VisCheckBox (String text, VisCheckBoxStyle style) {
	super(text, style);
	clearChildren();

	bgImage = new Image(style.checkBackground);
	tickImage = new Image(style.tick);
	imageStackCell = add(imageStack = new Stack(bgImage, tickImage));
	Label label = getLabel();
	add(label).padLeft(5);
	label.setAlignment(Align.left);
	setSize(getPrefWidth(), getPrefHeight());

	addListener(new InputListener() {
		@Override
		public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
			if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisCheckBox.this);
			return false;
		}
	});
}
 
Example #16
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 #17
Source File: Scene2dSteeringTest.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
protected void setRandomNonOverlappingPosition (SteeringActor character, Array<SteeringActor> others,
	float minDistanceFromBoundary) {
	int maxTries = Math.max(100, others.size * others.size); 
	SET_NEW_POS:
	while (--maxTries >= 0) {
		character.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center);
		character.getPosition().set(character.getX(Align.center), character.getY(Align.center));
		for (int i = 0; i < others.size; i++) {
			SteeringActor other = (SteeringActor)others.get(i);
			if (character.getPosition().dst(other.getPosition()) <= character.getBoundingRadius() + other.getBoundingRadius()
				+ minDistanceFromBoundary) continue SET_NEW_POS;
		}
		return;
	}
	throw new GdxRuntimeException("Probable infinite loop detected");
}
 
Example #18
Source File: AnimationDrawer.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public void setActor(BaseActor a) {
	if (renderer != null) {
		renderer.dispose();
		renderer = null;
	}

	if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer) {
		ActorRenderer r = ((SpriteActor) a).getRenderer();

		if (r instanceof Sprite3DRenderer) {
			renderer = new Sprite3DRenderer();
			((Sprite3DRenderer) renderer).setSpriteSize(new Vector2(r
					.getWidth(), r.getHeight()));
		} else if (r instanceof SpineRenderer) {
			renderer = new SpineRenderer();
			((SpineRenderer)renderer).enableEvents(false);
			((SpineRenderer)renderer).setSkin(((SpineRenderer) r).getSkin());
		} else if (r instanceof ImageRenderer) {
			renderer = new ImageRenderer();				
		} else if (r instanceof AtlasRenderer) {
			renderer = new AtlasRenderer();
		}
		
		renderer.setOrgAlign(Align.bottom);
	}
}
 
Example #19
Source File: DialogWelcome.java    From skin-composer with MIT License 6 votes vote down vote up
@Override
public Dialog show(Stage stage) {
    Dialog dialog = super.show(stage);
    
    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    fire(new DialogEvent(DialogEvent.Type.OPEN));
    return dialog;
}
 
Example #20
Source File: DialogWelcome.java    From skin-composer with MIT License 6 votes vote down vote up
@Override
public Dialog show(Stage stage, Action action) {
    Dialog dialog = super.show(stage, action);
    
    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    fire(new DialogEvent(DialogEvent.Type.OPEN));
    return dialog;
}
 
Example #21
Source File: ItemTooltip.java    From Unlucky with MIT License 6 votes vote down vote up
public ItemTooltip(Skin skin) {
    super("", skin);
    desc = new Label("", skin);
    desc.setFontScale(0.5f);
    this.getTitleLabel().setFontScale(0.5f);

    common = new Label.LabelStyle(skin.getFont("default-font"), new Color(1, 1, 1, 1));
    rare = new Label.LabelStyle(skin.getFont("default-font"), new Color(0, 200 / 255.f, 0, 1));
    epic = new Label.LabelStyle(skin.getFont("default-font"), new Color(0, 180 / 255.f, 1, 1));
    legendary = new Label.LabelStyle(skin.getFont("default-font"), new Color(164 / 255.f, 80 / 255.f, 1, 1));

    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 #22
Source File: AlignUtils.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
public static String getAlign(int align) {
	switch (align) {
	case Align.bottomRight:
		return "bottom-right";
	case Align.bottomLeft:
		return "bottom-left";
	case Align.topRight:
		return "top-right";
	case Align.topLeft:
		return "top-left";
	case Align.right:
		return "right";
	case Align.left:
		return "left";
	case Align.bottom:
		return "bottom";
	case Align.top:
		return "top";
	case Align.center:
		return "center";
	}

	return "";
}
 
Example #23
Source File: DialogWarnings.java    From skin-composer with MIT License 6 votes vote down vote up
@Override
public Dialog show(Stage stage) {
    Dialog dialog = super.show(stage);
    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    return dialog;
}
 
Example #24
Source File: DialogWarnings.java    From skin-composer with MIT License 6 votes vote down vote up
@Override
public Dialog show(Stage stage, Action action) {
    Dialog dialog = super.show(stage, action);
    
    if (getWidth() > Gdx.graphics.getWidth()) {
        setWidth(Gdx.graphics.getWidth());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    if (getHeight() > Gdx.graphics.getHeight()) {
        setHeight(Gdx.graphics.getHeight());
        setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
        setPosition((int) getX(), (int) getY());
    }
    
    resetWidth = getWidth();
    resetHeight = getHeight();
    main.getStage().setScrollFocus(scrollPane);
    return dialog;
}
 
Example #25
Source File: GameOverOverlay.java    From ud406 with MIT License 6 votes vote down vote up
public void render(SpriteBatch batch) {

        viewport.apply();
        batch.setProjectionMatrix(viewport.getCamera().combined);
        batch.begin();

        // TODO: Draw a game over message
        // Feel free to get more creative with this screen. Perhaps you could cover the screen in enemy robots?

        float timeElapsed = Utils.secondsSince(startTime);
        int enemiesToShow = (int) (Constants.ENEMY_COUNT * (timeElapsed / Constants.LEVEL_END_DURATION));

        for (int i = 0; i < enemiesToShow; i++){
            Enemy enemy = enemies.get(i);
            enemy.update(0);
            enemy.render(batch);
        }

        font.draw(batch, Constants.GAME_OVER_MESSAGE, viewport.getWorldWidth() / 2, viewport.getWorldHeight() / 2.5f, 0, Align.center, false);

        batch.end();

    }
 
Example #26
Source File: MonospaceFontGlyphLayoutTest.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
@Test
public void testLayoutRightAlignTooSmall() {
	final String str = "ab";

	glyphLayout.setText(str, color, FONT_CHARACTER_WIDTH - 1f, Align.right, true);

	Assert.assertEquals(FONT_CHARACTER_WIDTH - 1f, glyphLayout.getWidth(), 0.01f);
	Assert.assertEquals(FONT_LINE_HEIGHT * 2f, glyphLayout.getHeight(), 0.01f);
}
 
Example #27
Source File: IciclesScreen.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public void render(float delta) {
    icicles.update(delta);
    player.update(delta);
    if (player.hitByIcicle(icicles)) {
        icicles.init();
    }


    iciclesViewport.apply(true);
    Gdx.gl.glClearColor(BACKGROUND_COLOR.r, BACKGROUND_COLOR.g, BACKGROUND_COLOR.b, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.setProjectionMatrix(iciclesViewport.getCamera().combined);
    renderer.begin(ShapeType.Filled);
    icicles.render(renderer);
    player.render(renderer);
    renderer.end();

    hudViewport.apply();
    batch.setProjectionMatrix(hudViewport.getCamera().combined);
    batch.begin();

    topScore = Math.max(topScore, icicles.iciclesDodged);

    font.draw(batch, "Deaths: " + player.deaths + "\nDifficulty: " + difficulty.label,
            Constants.HUD_MARGIN, hudViewport.getWorldHeight() - Constants.HUD_MARGIN);
    font.draw(batch, "Score: " + icicles.iciclesDodged + "\nTop Score: " + topScore,
            hudViewport.getWorldWidth() - Constants.HUD_MARGIN, hudViewport.getWorldHeight() - Constants.HUD_MARGIN,
            0, Align.right, false);

    batch.end();

}
 
Example #28
Source File: MonsterLabelManager.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
protected void end() {
  if (!monsterLabel.isVisible()) return;
  batch.begin();
  tmpVec2.set(Gdx.graphics.getWidth() / 2, iso.viewportHeight * 0.05f);
  iso.unproject(tmpVec2);
  monsterLabel.setPosition(tmpVec2.x, tmpVec2.y, Align.top | Align.center);
  monsterLabel.draw(batch, 1);
  batch.end();
}
 
Example #29
Source File: StringSpin.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
private void addColumn(int index, int width, String text) {
    Label label = new Label(text, Config.skin);
    label.setAlignment(Align.center);
    label.setWidth(width);
    label.setX(width * index);

    addActor(label);
    labels.add(label);
}
 
Example #30
Source File: ShowTutorialMessage.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public void setTop(boolean onTop) {
    this.onTop = onTop;
    if (onTop) {
        align(Align.top);
        child.setBackground(Config.skin.getDrawable("ui-tutorial-message-background-top"));
    } else {
        align(Align.bottom);
        child.setBackground(Config.skin.getDrawable("ui-tutorial-message-background"));
    }
}