package de.samdev.colorrunner.screens.menu; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import de.samdev.colorrunner.CRGame; public class OptionMenuScreen implements Screen{ private Stage stage = new Stage(); private Table table = new Table(); private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"), new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack"))); private Label title = new Label("Option", skin); @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(); stage.draw(); } @Override public void resize(int width, int height) { // TODO Auto-generated method stub } @Override public void show() { TextButton buttonSound = new TextButton("Sound On/Off", skin); TextButton buttonBack = new TextButton("Back", skin); buttonSound.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y){ } }); buttonBack.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y) { CRGame.Inst().setScreen(new MainMenu()); } }); table.add(title).padBottom(40).row(); table.add(buttonSound).size((int)((double)Gdx.graphics.getWidth() / 2.0D),70).padBottom(20).row(); table.add(buttonBack).size((int)((double)Gdx.graphics.getWidth() / 2.0D), 70).padBottom(20).row(); table.setFillParent(true); stage.addActor(table); Gdx.input.setInputProcessor(stage); } @Override public void hide() { dispose(); } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { stage.dispose(); skin.dispose(); } }