public void show() { stage = new Stage(); Gdx.input.setInputProcessor(stage); atlas = new TextureAtlas("ui/atlas.pack"); skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas); Texture chipBg = new Texture(Gdx.files.internal("img/chips.png")); stage.addActor(new Image(chipBg)); table = new Table(skin); table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); table.bottom().right(); backButton = new TextButton("BACK", skin); backButton.addListener( new ClickListener() { public void clicked(InputEvent event, float x, float y) { ((Game) Gdx.app.getApplicationListener()).setScreen(new PotatoMenu()); } }); backButton.pad(10); table.add(backButton).bottom().right(); ; stage.addActor(table); tweenManager = new TweenManager(); Tween.registerAccessor(Actor.class, new ActorAccessor()); tweenManager.update(Gdx.graphics.getDeltaTime()); stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f))); }
public MainMenuScreen(LD33 game) { this.game = game; bgCam = new OrthographicCamera(1, 1); stage = new Stage(new FitViewport(400, 300)); Skin skin = game.assetMngr.get("skin.json", Skin.class); Table table = new Table(); table.setFillParent(true); stage.addActor(table); Label title = new Label("Where-Wolf", skin); title.setFontScale(4); table.add(title).pad(50); table.row(); TextButton startB = new TextButton("Start", skin); startB.setDisabled(true); startB.addListener( new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { MainMenuScreen.this.game.setScreen(new PlayScreen(MainMenuScreen.this.game, 1)); dispose(); return true; } }); table.add(startB).pad(1f).width(96); table.row(); TextButton levelB = new TextButton("Select level", skin); levelB.addListener( new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { MainMenuScreen.this.game.setScreen( new LevelsScreen(MainMenuScreen.this.game, MainMenuScreen.this)); return true; } }); levelB.setDisabled(true); table.add(levelB).pad(1f).width(96); table.row(); TextButton controlB = new TextButton("Controls", skin); controlB.addListener( new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { MainMenuScreen.this.game.setScreen( new ControlsScreen(MainMenuScreen.this.game, MainMenuScreen.this)); return true; } }); controlB.setDisabled(true); table.add(controlB).pad(1f).width(96); table.row(); TextButton exitB = new TextButton("Exit", skin); exitB.setDisabled(true); exitB.addListener( new ClickListener() { @Override public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) { Gdx.app.exit(); return true; } }); if (Gdx.app.getType() != Application.ApplicationType.WebGL) table.add(exitB).pad(1f).width(96); }