Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Label#setStyle()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Label#setStyle() . 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: BottomMenu.java    From Norii with Apache License 2.0 6 votes vote down vote up
private void updateStatsMenu() {
	final float statsWidth = Gdx.graphics.getWidth() - (HERO_PORTRAIT_WIDTH_TILES * tileWidthPixel);
	final float statsHeight = BOTTOM_MENU_HEIGHT_TILES * tileHeightPixel;

	statsGroup.setHeight(statsHeight);
	statsGroup.setWidth(statsWidth);
	final LabelStyle labelStyle = Utility.createLabelStyle("fonts/BreatheFireIi-2z9W.ttf", 105, 1, Color.LIGHT_GRAY, 1, 1);
	for (final Actor actor : statsGroup.getChildren()) {
		if (actor.getClass() == Label.class) {
			final Label label = (Label) actor;
			label.setStyle(labelStyle);
			label.setFontScale(Gdx.graphics.getWidth() * LABEL_FONT_SCALE, Gdx.graphics.getHeight() * LABEL_FONT_SCALE);
		}
	}
	statsGroup.setPosition(HERO_PORTRAIT_WIDTH_TILES * tileWidthPixel, 0);
}
 
Example 2
Source File: MessageTestBase.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: SteeringTestBase.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: PathFinderTestBase.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: SettingsScreen.java    From Unlucky with MIT License 4 votes vote down vote up
public SettingsScreen(final Unlucky game, final ResourceManager rm) {
    super(game, rm);

    // exit button
    stage.addActor(exitButton);
    exitButton.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            if (!game.player.settings.muteSfx) rm.buttonclick0.play(game.player.settings.sfxVolume);
            if (inGame) {
                game.gameScreen.resetGame = false;
                setFadeScreen(game.gameScreen);
                game.gameScreen.hud.settingsDialog.show(game.gameScreen.hud.getStage());
            }
            else {
                game.menuScreen.transitionIn = 2;
                setSlideScreen(game.menuScreen, false);
            }
        }
    });

    // create title label
    banner = new Image(rm.skin, "default-slider");
    banner.setPosition(8, 102);
    banner.setSize(164, 12);
    stage.addActor(banner);

    bannerLabel = new Label("SETTINGS", rm.skin);
    bannerLabel.setStyle(new Label.LabelStyle(rm.pixel10, new Color(1, 212 / 255.f, 0, 1)));
    bannerLabel.setSize(50, 12);
    bannerLabel.setTouchable(Touchable.disabled);
    bannerLabel.setPosition(14, 102);
    bannerLabel.setAlignment(Align.left);
    stage.addActor(bannerLabel);

    bg = new Image(rm.skin, "default-slider");
    bg.setPosition(8, 8);
    bg.setSize(184, 88);
    stage.addActor(bg);

    white = new Label.LabelStyle(rm.pixel10, Color.WHITE);
    description = new Label("SOUND                                 MISC",
        new Label.LabelStyle(rm.pixel10, new Color(1, 212 / 255.f, 0, 1)));
    description.setFontScale(0.75f);
    description.setTouchable(Touchable.disabled);
    description.setPosition(14, 85);
    stage.addActor(description);

    // create settings labels
    settingLabels = new Label[7];
    String[] settingStrs = new String[] {
        "MUSIC VOLUME", "SFX VOLUME", "MUTE MUSIC:", "MUTE SFX:",
        "SHOW ENEMY LEVELS:", "WEATHER ANIMATIONS:", "SHOW FPS:"
    };
    for (int i = 0; i < 7; i++) {
        settingLabels[i] = new Label(settingStrs[i], white);
        settingLabels[i].setTouchable(Touchable.disabled);
        settingLabels[i].setFontScale(0.5f);
        stage.addActor(settingLabels[i]);
    }
    for (int i = 0; i < 2; i++) settingLabels[i].setPosition(14, 76 - i * 24);
    for (int i = 2; i < 4; i++) settingLabels[i].setPosition(14, 26 - (i - 2) * 14);
    for (int i = 4; i < 7; i++) settingLabels[i].setPosition(111, 72 - (i - 4) * 16);

    createSliders();
    createCheckboxes();
}