Search in sources :

Example 1 with Stage

use of com.badlogic.gdx.scenes.scene2d.Stage 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 Stage

use of com.badlogic.gdx.scenes.scene2d.Stage 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 Stage

use of com.badlogic.gdx.scenes.scene2d.Stage 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 Stage

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

the class GameSceneState method loadResources.

@Override
public void loadResources() {
    this.skinManager = engine.getManager(SMGUIManager.class);
    this.assetsManager = engine.getManager(BaseAssetsManager.class);
    guiFactory = new GuiFactory(assetsManager, skin);
    bodyBuilder = new BodyBuilder();
    this.stage = new Stage();
    stage.clear();
    stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
    Gdx.input.setInputProcessor(stage);
    Gdx.app.log("Menu", "LoadResources");
    assetsManager.loadTextureAtlas(SPRITE_ATLAS);
    assetsManager.finishLoading();
}
Also used : Stage(com.badlogic.gdx.scenes.scene2d.Stage) GuiFactory(games.utils.GuiFactory) SMGUIManager(games.manager.SMGUIManager) BaseAssetsManager(com.ilargia.games.entitas.egdx.base.managers.BaseAssetsManager) BodyBuilder(ilargia.egdx.util.BodyBuilder)

Example 5 with Stage

use of com.badlogic.gdx.scenes.scene2d.Stage 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)

Aggregations

Stage (com.badlogic.gdx.scenes.scene2d.Stage)124 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)54 Texture (com.badlogic.gdx.graphics.Texture)51 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)48 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)47 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)40 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)40 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)39 Actor (com.badlogic.gdx.scenes.scene2d.Actor)38 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)30 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)28 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)25 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)24 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)21 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)20 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)19 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)18 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)15 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)12 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)11