use of com.badlogic.gdx.scenes.scene2d.ui.Label in project libgdx by libgdx.
the class BitmapFontTest method create.
@Override
public void create() {
spriteBatch = new SpriteBatch();
// font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), false);
font = new BitmapFont(Gdx.files.internal("data/arial-32-pad.fnt"), false);
// font = new FreeTypeFontGenerator(Gdx.files.internal("data/arial.ttf")).generateFont(new FreeTypeFontParameter());
font.getData().markupEnabled = true;
font.getData().breakChars = new char[] { '-' };
multiPageFont = new BitmapFont(Gdx.files.internal("data/multipagefont.fnt"));
// Add user defined color
Colors.put("PERU", Color.valueOf("CD853F"));
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
stage = new Stage(new ScreenViewport());
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
BitmapFont labelFont = skin.get("default-font", BitmapFont.class);
labelFont.getData().markupEnabled = true;
// Notice that the last [] has been deliberately added to test the effect of excessive pop operations.
// They are silently ignored, as expected.
label = new Label("<<[BLUE]M[RED]u[YELLOW]l[GREEN]t[OLIVE]ic[]o[]l[]o[]r[]*[MAROON]Label[][] [Unknown Color]>>", skin);
label.setPosition(100, 200);
stage.addActor(label);
Window window = new Window("[RED]Multicolor[GREEN] Title", skin);
window.setPosition(400, 300);
window.pack();
stage.addActor(window);
layout = new GlyphLayout();
}
use of com.badlogic.gdx.scenes.scene2d.ui.Label in project libgdx by libgdx.
the class ParticleEmittersTest method setupUI.
private void setupUI() {
ui = new Stage(new ExtendViewport(640, 480));
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
skipCleanup = new CheckBox("Skip blend function clean-up", skin);
skipCleanup.setTransform(false);
skipCleanup.addListener(listener);
logLabel = new Label("", skin.get(LabelStyle.class));
clearEmitters = new TextButton("Clear screen", skin);
clearEmitters.setTransform(false);
clearEmitters.addListener(listener);
Table table = new Table();
table.setTransform(false);
table.setFillParent(true);
table.defaults().padTop(5).left();
table.top().left().padLeft(5);
table.add(skipCleanup).row();
table.add(clearEmitters).row();
table.add(logLabel);
ui.addActor(table);
}
use of com.badlogic.gdx.scenes.scene2d.ui.Label in project libgdx by libgdx.
the class LabelTest method create.
@Override
public void create() {
batch = new SpriteBatch();
renderer = new ShapeRenderer();
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
skin.getAtlas().getTextures().iterator().next().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
skin.getFont("default-font").getData().markupEnabled = true;
float scale = 1;
skin.getFont("default-font").getData().setScale(scale);
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
Table table = new Table();
stage.addActor(table);
table.setPosition(200, 65);
table.debug();
table.add(new Label("This is regular text.", skin));
table.row();
table.add(new Label("This is regular text\nwith a newline.", skin));
table.row();
Label label3 = new Label("This is [RED]regular text\n\nwith newlines,\naligned bottom, right.", skin);
label3.setColor(Color.GREEN);
label3.setAlignment(Align.bottom | Align.right);
table.add(label3).minWidth(200 * scale).minHeight(110 * scale).fill();
table.row();
Label label4 = new Label("This is regular text with NO newlines, wrap enabled and aligned bottom, right.", skin);
label4.setWrap(true);
label4.setAlignment(Align.bottom | Align.right);
table.add(label4).minWidth(200 * scale).minHeight(110 * scale).fill();
table.row();
Label label5 = new Label("This is regular text with\n\nnewlines, wrap\nenabled and aligned bottom, right.", skin);
label5.setWrap(true);
label5.setAlignment(Align.bottom | Align.right);
table.add(label5).minWidth(200 * scale).minHeight(110 * scale).fill();
table.pack();
}
use of com.badlogic.gdx.scenes.scene2d.ui.Label in project libgdx by libgdx.
the class MipMapTest method createUI.
private void createUI() {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
ui = new Stage();
String[] filters = new String[TextureFilter.values().length];
int idx = 0;
for (TextureFilter filter : TextureFilter.values()) {
filters[idx++] = filter.toString();
}
hwMipMap = new CheckBox("Hardware Mips", skin);
minFilter = new SelectBox(skin);
minFilter.setItems(filters);
magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
magFilter.setItems("Nearest", "Linear");
Table table = new Table();
table.setSize(ui.getWidth(), 30);
table.setY(ui.getHeight() - 30);
table.add(hwMipMap).spaceRight(5);
table.add(new Label("Min Filter", skin)).spaceRight(5);
table.add(minFilter).spaceRight(5);
table.add(new Label("Mag Filter", skin)).spaceRight(5);
table.add(magFilter);
ui.addActor(table);
}
use of com.badlogic.gdx.scenes.scene2d.ui.Label in project libgdx by libgdx.
the class ContainerTest method label.
Table label(String text) {
Table table = new Table().debug();
table.add(new Label(text, skin)).fill().expand();
return table;
}
Aggregations