/** * by which menu Screen this option screen was called * * @param pScreen */ public OptionsScreen(MenuScreen pScreen) { screen = pScreen; game = screen.game; stage = new Stage(); stage.setViewport(800, 480, false); skin = new Skin(Gdx.files.internal("ui/myskin.json")); Table table = new Table(); table.setSize(800, 480); Label title = new Label("options", skin); title.setFontScale(2f); table.add(title).colspan(2).align(Align.center); table.row(); Label namel = new Label("name:", skin); table.add(namel); TextField name = new TextField("", skin); table.add(name); table.row(); Label graphicl = new Label("graphic:", skin); table.add(graphicl); CheckBox graphic = new CheckBox("", skin); table.add(graphic); table.row(); Label soundl = new Label("sound:", skin); table.add(soundl); final Slider sound = new Slider(0, 100, 1, false, skin); sound.setValue(game.preferences.getInteger("volume", 100)); table.add(sound); table.row(); Label themel = new Label("theme:", skin); table.add(themel); String[] items = {"cool", "mega", "awesome"}; SelectBox theme = new SelectBox(items, skin); theme.getSelection(); table.add(theme); table.row(); TextButton back = new TextButton("back to menu", skin); back.addListener( new ClickListener() { public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) { stage.addAction( Actions.sequence( Actions.moveTo(800, 0, 0.5f), new Action() { @Override public boolean act(float delta) { game.preferences.putInteger("volume", (int) sound.getValue()); game.preferences.flush(); Resources.page_turn.play(); screen.game.setScreen(screen); return false; } })); } }); table.add(back).colspan(2).align(Align.center).padTop(20); stage.addActor(table); stage.addAction(Actions.moveTo(800, 0)); stage.addAction(Actions.moveTo(0, 0, 0.5f)); Gdx.input.setInputProcessor(stage); }
protected void setAnimation() { ((SpriterPlayer) this.playerGroup.player).setAnimation(box.getSelection(), 1, 10); }