List of usage examples for com.badlogic.gdx.scenes.scene2d.actors Label Label
public Label(String name, BitmapFont font, String text)
From source file:com.badlogic.gdx.tests.lw.StageTestLW.java
License:Apache License
@Override public void create() { texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); font = new BitmapFont(); stage = new Stage(480, 320, false); float loc = (NUM_SPRITES * (32 + SPACING) - SPACING) / 2; for (int i = 0; i < NUM_GROUPS; i++) { Group group = new Group("group" + i); group.x = (float) Math.random() * (stage.width() - NUM_SPRITES * (32 + SPACING)); group.y = (float) Math.random() * (stage.height() - NUM_SPRITES * (32 + SPACING)); group.originX = loc;/* w ww . j av a 2 s . c om*/ group.originY = loc; fillGroup(group, texture); stage.addActor(group); } uiTexture = new Texture(Gdx.files.internal("data/ui.png")); uiTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); ui = new Stage(480, 320, false); Image blend = new Image("blend button", new TextureRegion(uiTexture, 0, 0, 64, 32)); blend.y = ui.height() - 64; Image rotate = new Image("rotate button", new TextureRegion(uiTexture, 64, 0, 64, 32)); rotate.y = blend.y; rotate.x = 64; Image scale = new Image("scale button", new TextureRegion(uiTexture, 64, 32, 64, 32)); scale.y = blend.y; scale.x = 128; ui.addActor(blend); ui.addActor(rotate); ui.addActor(scale); Label fps = new Label("fps", font, "fps: 0"); fps.x = 10; fps.y = 30; fps.color.set(0, 1, 0, 1); ui.addActor(fps); Thread.currentThread().setPriority(Thread.MAX_PRIORITY); renderer = new ImmediateModeRenderer(); Gdx.input.setInputProcessor(this); }