use of com.badlogic.gdx.scenes.scene2d.Stage in project libgdx by libgdx.
the class ActionSequenceTest method create.
@Override
public void create() {
stage = new Stage();
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
img = new Image(new TextureRegion(texture));
img.setSize(100, 100);
img.setOrigin(50, 50);
img.setPosition(100, 100);
img2 = new Image(new TextureRegion(texture));
img2.setSize(100, 100);
img2.setOrigin(50, 50);
img2.setPosition(100, 100);
img3 = new Image(new TextureRegion(texture));
img3.setSize(100, 100);
img3.setOrigin(50, 50);
img3.setPosition(100, 100);
stage.addActor(img);
stage.addActor(img2);
stage.addActor(img3);
img.addAction(sequence());
img2.addAction(parallel(sequence(), moveBy(100, 0, 1)));
img3.addAction(sequence(parallel(moveBy(100, 200, 2)), Actions.run(this)));
}
use of com.badlogic.gdx.scenes.scene2d.Stage 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.Stage in project libgdx by libgdx.
the class ActionTest method create.
@Override
public void create() {
stage = new Stage();
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
final Image img = new Image(new TextureRegion(texture));
img.setSize(100, 100);
img.setOrigin(50, 50);
img.setPosition(100, 100);
// img.addAction(forever(sequence(delay(1.0f), new Action() {
// public boolean act (float delta) {
// System.out.println(1);
// img.clearActions();
// return true;
// }
// })));
img.addAction(Actions.moveBy(100, 0, 2));
img.addAction(Actions.after(Actions.scaleTo(2, 2, 2)));
stage.addActor(img);
}
use of com.badlogic.gdx.scenes.scene2d.Stage in project libgdx by libgdx.
the class NoncontinuousRenderingTest method create.
@Override
public void create() {
batch = new SpriteBatch();
texture = new Texture("data/badlogic.jpg");
region = new TextureRegion(texture);
stage = new Stage(new ScreenViewport(), batch);
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
skin.add("default", font = new BitmapFont(Gdx.files.internal("data/arial-32.fnt"), false));
populateTable();
Gdx.graphics.setContinuousRendering(false);
Gdx.graphics.requestRendering();
}
use of com.badlogic.gdx.scenes.scene2d.Stage 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);
}
Aggregations