Search in sources :

Example 1 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AmazingMaze by TheVirtualMachine.

the class CreditsScreen method setupComponents.

/**
	 * Instantiate the stage and its actors for the credits screen.
	 * Add all actors to the stage.
	 */
private void setupComponents() {
    stage = new Stage();
    table = new Table();
    table.top();
    table.setFillParent(true);
    stage.addActor(table);
    gameLogo = new Image(game.assets.manager.get(Assets.GAME_LOGO, Texture.class));
    header = new Label("", game.assets.skin, Assets.SERIF_HEADER_STYLE);
    codeGroup = setupCreditsLabel(CODE, Assets.CREDITS_CONTENTS);
    artGroup = setupCreditsLabel(ART, Assets.CREDITS_CONTENTS);
    storyGroup = setupCreditsLabel(STORY, Assets.CREDITS_CONTENTS);
    musicGroup = setupCreditsLabel(MUSIC, Assets.SMALL_CREDITS_CONTENTS);
    thanksGroup = setupCreditsLabel(THANKS, Assets.CREDITS_CONTENTS);
    companyLogo = new Image(game.assets.manager.get(Assets.COMPANY_LOGO, Texture.class));
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Example 2 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AmazingMaze by TheVirtualMachine.

the class MazeScreen 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("Main Menu", game.assets.skin);
    quitButton.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            game.setScreen(game.menuScreen);
        }
    });
    table.add(quitButton).pad(10).width(Gdx.graphics.getWidth() / 4).height(Gdx.graphics.getHeight() / 8);
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Screen(com.badlogic.gdx.Screen) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Stage(com.badlogic.gdx.scenes.scene2d.Stage) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport)

Example 3 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project AmazingMaze by TheVirtualMachine.

the class StoryScreen method setupUI.

/** Helper method to setup the UI. */
private void setupUI() {
    stage = new Stage(new ScreenViewport(), game.batch);
    table = new Table();
    table.top().center();
    table.setFillParent(true);
    stage.addActor(table);
    header = new Label("Story", game.assets.skin, Assets.SERIF_HEADER_STYLE);
    table.add(header).padTop(Gdx.graphics.getHeight() / 25f);
    storyLabel = new Label(readStory(), game.assets.skin, Assets.STORY_STYLE);
    storyLabel.setWrap(true);
    table.row();
    table.add(storyLabel).maxWidth(Gdx.graphics.getWidth()).prefWidth(Gdx.graphics.getWidth() / 1.125f).pad(Gdx.graphics.getHeight() / 25f);
    continueButton = new TextButton("Continue...", game.assets.skin);
    continueButton.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (continueButton.isPressed()) {
                game.setScreen(new MazeScreen(game, false));
            }
        }
    });
    table.row();
    table.add(continueButton).width(Gdx.graphics.getWidth() / 4f).pad(Gdx.graphics.getHeight() / 25f).expandY().bottom().fillY();
}
Also used : TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport)

Example 4 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project Entitas-Java by Rubentxu.

the class MenuState method loadResources.

@Override
public void loadResources() {
    assetsManager = engine.getManager(BaseAssetsManager.class);
    this.stage = new Stage();
    mainTable = new Table();
    mainTable.setFillParent(true);
    stage.clear();
    stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
    this.stage.addActor(mainTable);
    Gdx.input.setInputProcessor(stage);
    Gdx.app.log("Menu", "LoadResources");
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Stage(com.badlogic.gdx.scenes.scene2d.Stage) BaseAssetsManager(com.ilargia.games.entitas.egdx.base.managers.BaseAssetsManager)

Example 5 with Table

use of com.badlogic.gdx.scenes.scene2d.ui.Table in project libgdx by libgdx.

the class Stage method drawDebug.

private void drawDebug() {
    if (debugShapes == null) {
        debugShapes = new ShapeRenderer();
        debugShapes.setAutoShapeType(true);
    }
    if (debugUnderMouse || debugParentUnderMouse || debugTableUnderMouse != Debug.none) {
        screenToStageCoordinates(tempCoords.set(Gdx.input.getX(), Gdx.input.getY()));
        Actor actor = hit(tempCoords.x, tempCoords.y, true);
        if (actor == null)
            return;
        if (debugParentUnderMouse && actor.parent != null)
            actor = actor.parent;
        if (debugTableUnderMouse == Debug.none)
            actor.setDebug(true);
        else {
            while (actor != null) {
                if (actor instanceof Table)
                    break;
                actor = actor.parent;
            }
            if (actor == null)
                return;
            ((Table) actor).debug(debugTableUnderMouse);
        }
        if (debugAll && actor instanceof Group)
            ((Group) actor).debugAll();
        disableDebug(root, actor);
    } else {
        if (debugAll)
            root.debugAll();
    }
    Gdx.gl.glEnable(GL20.GL_BLEND);
    debugShapes.setProjectionMatrix(viewport.getCamera().combined);
    debugShapes.begin();
    root.drawDebug(debugShapes);
    debugShapes.end();
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ShapeRenderer(com.badlogic.gdx.graphics.glutils.ShapeRenderer)

Aggregations

Table (com.badlogic.gdx.scenes.scene2d.ui.Table)93 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)56 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)50 Stage (com.badlogic.gdx.scenes.scene2d.Stage)48 Actor (com.badlogic.gdx.scenes.scene2d.Actor)43 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)38 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)34 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)32 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)25 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)23 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)18 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)18 Texture (com.badlogic.gdx.graphics.Texture)17 Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)14 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)14 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)13 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)13 SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)13 Button (com.badlogic.gdx.scenes.scene2d.ui.Button)12 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)12