use of com.badlogic.gdx.utils.viewport.ScreenViewport 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.utils.viewport.ScreenViewport 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.utils.viewport.ScreenViewport in project libgdx by libgdx.
the class ColorTest method create.
@Override
public void create() {
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
skin.add("default", new BitmapFont(Gdx.files.internal("data/arial-32.fnt"), false));
Table root = new Table();
stage.addActor(root);
root.setFillParent(true);
Table column1 = new Table(skin);
column1.add("WHITE", "default", Color.WHITE).row();
column1.add("LIGHT_GRAY", "default", Color.LIGHT_GRAY).row();
column1.add("GRAY", "default", Color.GRAY).row();
column1.add("DARK_GRAY", "default", Color.DARK_GRAY).row();
column1.add("BLUE", "default", Color.BLUE).row();
column1.add("NAVY", "default", Color.NAVY).row();
column1.add("ROYAL", "default", Color.ROYAL).row();
column1.add("SLATE", "default", Color.SLATE).row();
column1.add("SKY", "default", Color.SKY).row();
column1.add("CYAN", "default", Color.CYAN).row();
column1.add("TEAL", "default", Color.TEAL).row();
Table column2 = new Table(skin);
column2.add("GREEN", "default", Color.GREEN).row();
column2.add("CHARTREUSE", "default", Color.CHARTREUSE).row();
column2.add("LIME", "default", Color.LIME).row();
column2.add("FOREST", "default", Color.FOREST).row();
column2.add("OLIVE", "default", Color.OLIVE).row();
column2.add("YELLOW", "default", Color.YELLOW).row();
column2.add("GOLD", "default", Color.GOLD).row();
column2.add("GOLDENROD", "default", Color.GOLDENROD).row();
column2.add("ORANGE", "default", Color.ORANGE).row();
column2.add("BROWN", "default", Color.BROWN).row();
column2.add("TAN", "default", Color.TAN).row();
column2.add("FIREBRICK", "default", Color.FIREBRICK).row();
Table column3 = new Table(skin);
column3.add("RED", "default", Color.RED).row();
column3.add("SCARLET", "default", Color.SCARLET).row();
column3.add("CORAL", "default", Color.CORAL).row();
column3.add("SALMON", "default", Color.SALMON).row();
column3.add("PINK", "default", Color.PINK).row();
column3.add("MAGENTA", "default", Color.MAGENTA).row();
column3.add("PURPLE", "default", Color.PURPLE).row();
column3.add("VIOLET", "default", Color.VIOLET).row();
column3.add("MAROON", "default", Color.MAROON).row();
root.add(column1);
root.add(column2);
root.add(column3);
}
use of com.badlogic.gdx.utils.viewport.ScreenViewport in project AmazingMaze by TheVirtualMachine.
the class MazeScreen method setupHUD.
/** Create the game HUD. */
private void setupHUD() {
hud = new Stage(new ScreenViewport(), game.batch);
Table table = new Table();
table.setFillParent(true);
table.top().left();
hud.addActor(table);
Label level = new Label("Level " + game.save.getLevel(), game.assets.skin, Assets.HUD_STYLE);
table.add(level).colspan(2);
table.row();
Image lifeIcon = new Image(game.assets.manager.get(Assets.LIFE_HUD_IMAGE, Texture.class));
table.add(lifeIcon).pad(Gdx.graphics.getWidth() / 128).left();
livesLeft = new Label("", game.assets.skin, Assets.HUD_STYLE);
table.add(livesLeft);
updateLives(-2);
}
use of com.badlogic.gdx.utils.viewport.ScreenViewport in project AmazingMaze by TheVirtualMachine.
the class FishMiniGame method setupPauseMenu.
/** Create the pause menu. */
private void setupPauseMenu() {
pauseMenu = new Stage(new ScreenViewport(), game.batch);
Table table = new Table();
table.setFillParent(true);
table.center();
pauseMenu.addActor(table);
TextButton resumeButton = new TextButton("Resume", game.assets.skin);
resumeButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
paused = false;
}
});
table.add(resumeButton).pad(10).width(Gdx.graphics.getWidth() / 4).height(Gdx.graphics.getHeight() / 8);
table.row();
TextButton settingsButton = new TextButton("Settings", game.assets.skin);
final Screen sourceScreen = this;
settingsButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
game.settingsScreen.setSourceScreen(sourceScreen);
game.setScreen(game.settingsScreen);
}
});
table.add(settingsButton).pad(10).width(Gdx.graphics.getWidth() / 4).height(Gdx.graphics.getHeight() / 8);
table.row();
TextButton quitButton = new TextButton("Quit", game.assets.skin);
quitButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
game.save.setLevel(game.save.getLevel() - 1);
game.setScreen(game.menuScreen);
}
});
table.add(quitButton).pad(10).width(Gdx.graphics.getWidth() / 4).height(Gdx.graphics.getHeight() / 8);
}
Aggregations