@Override public void show() { stage = new Stage(); Gdx.input.setInputProcessor(stage); table = new Table(); table.setFillParent(true); // table.row(); table.right(); mainInit(); buttonInit(); stage.addActor(table); }
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); }