Back to project page diploma-assignment.
The source code is released under:
MIT License
If you think the Android project diploma-assignment listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.me.openingscreen; //from w ww . j a v a2 s. c o m import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.Stage; import com.me.battlescreen.MyButton; public class FirstMenu extends AbstractMenu{ MyButton exit; MyButton toPlayerScreen; MyButton resetPlayer; public FirstMenu(OpeningScreen s, Stage st) { super(s, st); // TODO Auto-generated constructor stub createButtons(); addListeners(); } @Override protected void createButtons() { Texture t=new Texture(Gdx.files.internal("data/menus/exit.png")); exit=new MyButton(t); createButton(exit,1,t,1); t=new Texture(Gdx.files.internal("data/menus/player.png")); toPlayerScreen=new MyButton(t); createButton(toPlayerScreen,7,t,1); t=new Texture(Gdx.files.internal("data/menus/reset.png")); resetPlayer=new MyButton(t); createButton(resetPlayer,5,t,1); } @Override protected void addListeners() { addToPlayerListener(); addResetListener(); addExitListener(); } private void addToPlayerListener() { // TODO Auto-generated method stub toPlayerScreen.addListener(new InputListener(){ public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { toPlayerScreen.setPressed(true); return true; } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { toPlayerScreen.setPressed(false); screen.setMenu(new PlayerMenu(screen,stage)); } }); } private void addResetListener() { // TODO Auto-generated method stub resetPlayer.addListener(new InputListener(){ public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { resetPlayer.setPressed(true); return true; } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { resetPlayer.setPressed(false); screen.setMenu(new ResetMenu(screen,stage)); } }); } private void addExitListener() { // TODO Auto-generated method stub exit.addListener(new InputListener(){ public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { exit.setPressed(true); return true; } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { exit.setPressed(false); screen.game.dispose(); } }); } }