use of com.badlogic.gdx.scenes.scene2d.ui.Table in project libgdx by libgdx.
the class ContainerTest method create.
@Override
public void create() {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage();
Gdx.input.setInputProcessor(stage);
TextureRegionDrawable logo = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg"))));
Table root = new Table();
root.setFillParent(true);
root.debug().defaults().space(6).size(110);
stage.addActor(root);
root.add(new Container(label("center")));
root.add(new Container(label("top")).top());
root.add(new Container(label("right")).right());
root.add(new Container(label("bottom")).bottom());
root.add(new Container(label("left")).left());
root.row();
root.add(new Container(label("fill")).fill());
root.add(new Container(label("fillX")).fillX());
root.add(new Container(label("fillY")).fillY());
root.add(new Container(label("fill 75%")).fill(0.75f, 0.75f));
root.add(new Container(label("fill 75% br")).fill(0.75f, 0.75f).bottom().right());
root.row();
root.add(new Container(label("padTop 5\ntop")).padTop(5).top());
root.add(new Container(label("padBottom 5\nbottom")).padBottom(5).bottom());
root.add(new Container(label("padLeft 15")).padLeft(15));
root.add(new Container(label("pad 10 fill")).pad(10).fill());
root.add(new Container(label("pad 10 tl")).pad(10).top().left());
root.row();
root.add(new Container(label("bg")).background(logo));
root.add(new Container(label("bg height 50")).background(logo).height(50));
Container transformBG = new Container(label("bg transform")).background(logo);
transformBG.setTransform(true);
transformBG.setOrigin(55, 55);
transformBG.rotateBy(90);
root.add(transformBG);
Container transform = new Container(label("transform"));
transform.setTransform(true);
transform.setOrigin(55, 55);
transform.rotateBy(90);
root.add(transform);
Container clip = new Container(label("clip1clip2clip3clip4"));
clip.setClip(true);
root.add(clip);
}
use of com.badlogic.gdx.scenes.scene2d.ui.Table in project libgdx by libgdx.
the class GroupCullingTest method create.
public void create() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
root = new Table();
root.setFillParent(true);
stage.addActor(root);
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Table labels = new Table();
root.add(new ScrollPane(labels, skin)).expand().fill();
root.row();
root.add(drawnLabel = new Label("", skin));
for (int i = 0; i < count; i++) {
labels.add(new Label("Label: " + i, skin) {
public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
drawn++;
}
});
labels.row();
}
}
use of com.badlogic.gdx.scenes.scene2d.ui.Table in project libgdx by libgdx.
the class ViewportTest1 method create.
public void create() {
stage = new Stage();
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
label = new Label("", skin);
Table root = new Table(skin);
root.setFillParent(true);
root.setBackground(skin.getDrawable("default-pane"));
root.debug().defaults().space(6);
root.add(new TextButton("Button 1", skin));
root.add(new TextButton("Button 2", skin)).row();
root.add("Press spacebar to change the viewport:").colspan(2).row();
root.add(label).colspan(2);
stage.addActor(root);
viewports = getViewports(stage.getCamera());
names = getViewportNames();
stage.setViewport(viewports.first());
label.setText(names.first());
Gdx.input.setInputProcessor(new InputMultiplexer(new InputAdapter() {
public boolean keyDown(int keycode) {
if (keycode == Input.Keys.SPACE) {
int index = (viewports.indexOf(stage.getViewport(), true) + 1) % viewports.size;
label.setText(names.get(index));
Viewport viewport = viewports.get(index);
stage.setViewport(viewport);
resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
return false;
}
}, stage));
}
use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AnotherMonekyParadox by SantiagoMille.
the class PantallaScoresStory method crearMenu.
@Override
void crearMenu() {
super.stageMenu = new Stage(vista);
title = new Texto(1, 1, 1);
imgBackground = new Texture("logros.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setPosition(0, 0);
// spriteBackground.setAlpha(0.7f);
Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
String names = prefs.getString("names", null);
if (names == null) {
// prefs.putString("names", "Astro");
names = "Astro,";
}
String scores = prefs.getString("highscores", null);
if (scores == null) {
// prefs.putString("highscores", "10000");
scores = "10000,";
}
Table table = new Table(skin);
table.defaults().pad(10f);
table.setFillParent(true);
table.setPosition(table.getX(), table.getY() + 250);
/**
* Se hace el titulo de scores
*/
// Label scoresTitle = new Label("HIGHSCORES STORY MODE", skin);
// scoresTitle.setFontScale(4f,4f);
// scoresTitle.setAlignment(Align.center);
/**
* Se crean las columnas con puntuajes
*/
Label columnName;
Label columnScore;
String[] allScores = scores.split(",");
String[] allNames = names.split(",");
int i = 0;
// table.add(scoresTitle).colspan(2).fillX().height(150);
table.row();
for (String name : allNames) {
columnName = new Label(name + ": ", skin);
columnName.setFontScale(3f, 3f);
table.add(columnName);
columnScore = new Label(allScores[i], skin);
columnScore.setFontScale(3f, 3f);
table.add(columnScore);
i++;
table.row();
}
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
// Click en boton Return
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
main.setScreen(new PantallaMenu(main));
}
});
stageMenu.addActor(table);
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.ui.Table in project skin-composer by raeleus.
the class RootTable method addStyleAndPreviewSplit.
private void addStyleAndPreviewSplit() {
stylePropertiesTable = new Table();
stylePropertiesTable.setTouchable(Touchable.enabled);
addStyleProperties(stylePropertiesTable);
Table right = new Table();
right.setTouchable(Touchable.enabled);
addPreviewPreviewPropertiesSplit(right, scrollPaneListener);
SplitPane splitPane = new SplitPane(stylePropertiesTable, right, false, getSkin());
add(splitPane).grow();
splitPane.addListener(new InputListener() {
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
}
}
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.HorizontalResize);
}
}
});
splitPane.addListener(new DragListener() {
@Override
public void dragStop(InputEvent event, float x, float y, int pointer) {
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.Arrow);
draggingCursor = false;
}
@Override
public void dragStart(InputEvent event, float x, float y, int pointer) {
if (!draggingCursor && event.getListenerActor().equals(event.getTarget())) {
Gdx.graphics.setSystemCursor(Cursor.SystemCursor.HorizontalResize);
draggingCursor = true;
}
}
});
}
Aggregations