use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaMenu method crearMenu.
private void crearMenu() {
cargarTexturas();
stageMenu = new Stage(vista);
spriteBackground = new Sprite(backgroundStory);
spriteBackground.setPosition(0, 0);
spriteLogo = new Sprite(imgLogo);
spriteLogo.setPosition(ANCHO / 2 - spriteLogo.getWidth() / 2, ALTO - spriteLogo.getHeight() - 40);
// Boton Play
TextureRegionDrawable trdPlay = new TextureRegionDrawable(new TextureRegion(botonPlay));
TextureRegionDrawable trdPlayPressed = new TextureRegionDrawable(new TextureRegion(botonPlayPressed));
ImageButton btnPlay = new ImageButton(trdPlay, trdPlayPressed);
btnPlay.setPosition(ANCHO / 2 - btnPlay.getWidth() / 2, -100);
btnPlay.addAction(Actions.moveTo(ANCHO / 2 - btnPlay.getWidth() / 2, ALTO / 4 - btnPlay.getHeight() / 2, 0.5f));
// Boton Leaderboard
TextureRegionDrawable trdLead = new TextureRegionDrawable(new TextureRegion(botonLeaderboard));
TextureRegionDrawable trdLeadPush = new TextureRegionDrawable(new TextureRegion(botonLeaderboardPressed));
ImageButton btnLead = new ImageButton(trdLead, trdLeadPush);
btnLead.setPosition(-200, ALTO / 4 - btnLead.getHeight() / 2);
btnLead.addAction(Actions.moveTo(ANCHO / 4 - btnLead.getWidth() / 2, ALTO / 4 - btnLead.getHeight() / 2, 0.5f));
// Boton CONFIG
TextureRegionDrawable trdConfig = new TextureRegionDrawable(new TextureRegion(botonAbout));
TextureRegionDrawable trdConfigPush = new TextureRegionDrawable(new TextureRegion(botonAboutPressed));
ImageButton btnConfig = new ImageButton(trdConfig, trdConfigPush);
btnConfig.setPosition(ANCHO + 200, ALTO / 4 - btnConfig.getHeight() / 2);
btnConfig.addAction(Actions.moveTo(ANCHO * 3 / 4 - btnConfig.getWidth() / 2, ALTO / 4 - btnConfig.getHeight() / 2, 0.5f));
// Boton Tutorial
TextureRegionDrawable trdTut = new TextureRegionDrawable(new TextureRegion(botonTutorial));
TextureRegionDrawable trdTutPush = new TextureRegionDrawable(new TextureRegion(botonTutorialPressed));
ImageButton btnTut = new ImageButton(trdTut, trdTutPush);
btnTut.setSize(105, 105);
btnTut.setPosition(ANCHO - btnTut.getWidth() - 30, ALTO * 8 / 10 + 30);
// Boton modo horda
TextureRegionDrawable trdHorda = new TextureRegionDrawable(new TextureRegion(new Texture("arrow-point-to-right.png")));
btnHorda = new ImageButton(trdHorda);
btnHorda.setSize(60, 60);
btnHorda.setPosition(ANCHO - btnHorda.getWidth() - 50, ALTO / 2 - btnHorda.getHeight() / 2 - 10);
// Boton regresar de modo horda
TextureRegionDrawable trdRegresarHorda = new TextureRegionDrawable(new TextureRegion(new Texture("arrow-point-to-left.png")));
btnRegresarHorda = new ImageButton(trdRegresarHorda);
btnRegresarHorda.setSize(60, 60);
btnRegresarHorda.setVisible(false);
btnRegresarHorda.setPosition(50, ALTO / 2 - btnRegresarHorda.getHeight() / 2 - 10);
// Click en boton Play
btnPlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
if (isSurvivalMode) {
main.setScreen(new PantallaCargandoStoryMode(main, 5, 0, 3, 5));
} else {
// main.setScreen(new PantallaCargandoStoryMode(main, 1, 0,3,5));
main.setScreen(new PantallaHistoriaAstro(main));
}
}
});
// Click en boton Lead
btnLead.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
if (isSurvivalMode) {
main.setScreen(new PantallaScoresSurvival(main));
} else {
main.setScreen(new PantallaScoresStory(main));
}
}
});
// Click en boton Developer
btnTut.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
main.setScreen(new PantallaDeveloper(main));
}
});
// Click en boton Horda
btnHorda.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
isSurvivalMode = true;
spriteBackground = new Sprite(backgroundSurvival);
spriteBackground.setPosition(0, 0);
btnHorda.setVisible(false);
btnRegresarHorda.setVisible(true);
}
});
// Click para regresar al modo historia
btnRegresarHorda.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
isSurvivalMode = false;
spriteBackground = new Sprite(backgroundStory);
spriteBackground.setPosition(0, 0);
btnRegresarHorda.setVisible(false);
btnHorda.setVisible(true);
}
});
// Click en boton Tutorial
btnConfig.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
if (isSurvivalMode) {
String toWrite = "Survive as long as you can, fight Dr. Timetravelov's \nminions.\n\n" + "- Use the joystick\nto move forwards and backwards. \n" + "- Use the blue button to shoot bananas.\n" + "- Use the red button to throw banana grenades.";
main.setScreen(new PantallaTutorial(main, toWrite, false));
} else {
String toWrite = "Astro is seeking revenge against Dr. Timetravelov...\n\n" + "- Use the joystick to move forwards and \n backwards. \n" + "- Use the blue button to shoot bananas.\n" + "- Use the red button to throw banana grenades.";
main.setScreen(new PantallaTutorial(main, toWrite, true));
}
}
});
stageMenu.addActor(btnPlay);
stageMenu.addActor(btnLead);
stageMenu.addActor(btnConfig);
stageMenu.addActor(btnTut);
stageMenu.addActor(btnHorda);
stageMenu.addActor(btnRegresarHorda);
inputMultiplexer.addProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaSurvival method crearMenu.
private void crearMenu() {
stageMenu = new Stage(vista);
imgBackground = new Texture("Background.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setPosition(0, 0);
imgLogo = new Texture("LOGO-2.png");
spriteLogo = new Sprite(imgLogo);
spriteLogo.setPosition(ANCHO / 2 - spriteLogo.getWidth() / 2, ALTO - spriteLogo.getHeight() - 50);
// Boton Play
TextureRegionDrawable trdPlay = new TextureRegionDrawable(new TextureRegion(new Texture("button_start.png")));
TextureRegionDrawable trdPlayPressed = new TextureRegionDrawable(new TextureRegion(new Texture("button_start_pressed.png")));
ImageButton btnPlay = new ImageButton(trdPlay, trdPlayPressed);
btnPlay.setPosition(ANCHO / 2 - btnPlay.getWidth() / 2, ALTO / 4 - btnPlay.getHeight() / 2);
// Boton Leaderboard
TextureRegionDrawable trdLead = new TextureRegionDrawable(new TextureRegion(new Texture("but-lead.png")));
TextureRegionDrawable trdLeadPush = new TextureRegionDrawable(new TextureRegion(new Texture("but-lead-push.png")));
ImageButton btnLead = new ImageButton(trdLead, trdLeadPush);
btnLead.setPosition(ANCHO / 4 - btnLead.getWidth() / 2, ALTO / 4 - btnLead.getHeight() / 2);
// Boton Config
TextureRegionDrawable trdConfig = new TextureRegionDrawable(new TextureRegion(new Texture("configButton.png")));
TextureRegionDrawable trdConfigPush = new TextureRegionDrawable(new TextureRegion(new Texture("configButton.png")));
ImageButton btnConfig = new ImageButton(trdConfig, trdConfigPush);
btnConfig.setPosition(ANCHO * 9 / 10, ALTO * 8 / 10);
btnConfig.setSize(95, 95);
// Boton Tutorial
TextureRegionDrawable trdTut = new TextureRegionDrawable(new TextureRegion(new Texture("but-tut.png")));
TextureRegionDrawable trdTutPush = new TextureRegionDrawable(new TextureRegion(new Texture("but-tut-push.png")));
ImageButton btnTut = new ImageButton(trdTut, trdTutPush);
btnTut.setPosition(ANCHO * 9 / 10 - btnTut.getWidth() / 2, ALTO * 9 / 10 - btnTut.getHeight() / 2);
// Click en boton Play
btnPlay.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
main.setScreen(new PantallaCargandoStoryMode(main, 5, 0, 3, 5));
}
});
// Click en boton Lead
btnLead.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
main.setScreen(new PantallaScoresSurvival(main));
}
});
// Click en boton Tutorial
btnTut.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
String toWrite = "Astro is seeking revenge against Dr. Timetravelov...\n\n" + "- Use the joystick to move forwards and \n backwards. \n" + "- Use the blue button to shoot bananas.\n" + "- Use the red button to throw banana grenades.";
main.setScreen(new PantallaTutorial(main, toWrite, true));
}
});
// Click en boton Config
btnConfig.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
dispose();
main.setScreen(new PantallaDeveloper(main));
}
});
stageMenu.addActor(btnPlay);
stageMenu.addActor(btnLead);
stageMenu.addActor(btnConfig);
stageMenu.addActor(btnTut);
Gdx.input.setInputProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaCredits method crearMenu.
private void crearMenu() {
stageMenu = new Stage(vista);
title = new Texto(1, 1, 1);
Adrian = new Texto(1, 1, 1);
Santi = new Texto(1, 1, 1);
Fer = new Texto(1, 1, 1);
Brian = new Texto(1, 1, 1);
Diego = new Texto(1, 1, 1);
imgBackground = new Texture("space.png");
adrian = new Texture("pp.jpg");
santi = new Texture("pp.jpg");
fernando = new Texture("pp.jpg");
diego = new Texture("pp.jpg");
brian = new Texture("pp.jpg");
spriteBackground = new Sprite(imgBackground);
// spriteBackground.setAlpha(0.7f);
adr = new Sprite(adrian);
bri = new Sprite(brian);
die = new Sprite(diego);
fer = new Sprite(fernando);
san = new Sprite(santi);
adr.setScale(.15f);
san.setScale(.15f);
die.setScale(.15f);
fer.setScale(.15f);
bri.setScale(.15f);
adr.setPosition(600, 250);
bri.setPosition(600, 130);
die.setPosition(600, 20);
san.setPosition(600, -100);
fer.setPosition(600, -220);
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// Gdx.app.log("ClickListener","Si se clickeoooo");
main.setScreen(new PantallaDeveloper(main));
}
});
// Fotos
foto.setScaling(Scaling.fit);
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaDeveloper method crearMenu.
private void crearMenu() {
stageMenu = new Stage(vista);
prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
imgBackground = new Texture("pantalla_config.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setAlpha(0.7f);
container = new Table();
stageMenu.addActor(container);
container.setFillParent(true);
container.setPosition(0, 30);
Table table = new Table();
final ScrollPane scroll = new ScrollPane(table, skin);
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(ANCHO - 80, ALTO - 30 - btnReturn.getHeight());
// Click en boton Return
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
prefs.putFloat("Difficulty", difficulty);
prefs.putFloat("Sensitivity", sensitivity);
main.setScreen(new PantallaMenu(main));
}
});
InputListener stopTouchDown = new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.stop();
difficulty = x;
return false;
}
};
InputListener stopTouchDown2 = new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
event.stop();
sensitivity = x;
return false;
}
};
table.pad(10).defaults().expandX().space(4);
titulo = new Texto(1, 1, 1);
table.row();
table.row();
table.row();
table.row();
table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
table.row();
table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
TextButton buttonVolumen = new TextButton("Difficulty", skin);
table.add(buttonVolumen);
buttonVolumen.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("click " + x + ", " + y);
}
});
Slider sliderDif = new Slider(0, 100, 1, false, skin);
// Stops touchDown events from propagating to the FlickScrollPane.
sliderDif.addListener(stopTouchDown);
table.add(sliderDif);
table.add(new Label(" ", skin));
table.row();
table.add(new Label(" ", skin));
table.row();
table.add(new Label(" ", skin));
table.row();
table.add(new Label(" ", skin)).expandX().fillX();
TextButton buttonSensitivity = new TextButton("Sensitivity", skin);
table.add(buttonSensitivity);
buttonSensitivity.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("click " + x + ", " + y);
}
});
Slider sliderSens = new Slider(0, 100, 1, false, skin);
// Stops touchDown events from propagating to the FlickScrollPane.
sliderSens.addListener(stopTouchDown2);
table.add(sliderSens);
table.add(new Label(" ", skin));
final TextButton creditsButton = new TextButton("Creditos", skin.get("default", TextButton.TextButtonStyle.class));
creditsButton.setChecked(true);
creditsButton.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
scroll.setFlickScroll(creditsButton.isChecked());
prefs.putFloat("Difficulty", difficulty);
prefs.putFloat("Sensitivity", sensitivity);
main.setScreen(new PantallaCredits(main));
}
});
container.add(scroll).expand().fill().colspan(4);
container.row().space(10).padBottom(10);
container.add(new Label(" ", skin));
table.row();
table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
table.row();
table.add(new Label("\n\n\n\n\n\n\n\n\n\n\n ", skin));
table.row();
container.add(creditsButton).left().expandX();
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
float ddiiff = prefs.getFloat("Difficulty");
sliderDif.setX(ddiiff);
sliderSens.setX(prefs.getFloat("Sensitivity"));
}
use of com.badlogic.gdx.scenes.scene2d.utils.ClickListener in project AnotherMonekyParadox by SantiagoMille.
the class PantallaScoresSurvival method crearMenu.
@Override
void crearMenu() {
super.stageMenu = new Stage(vista);
title = new Texto(1, 1, 1);
imgBackground = new Texture("logros.png");
spriteBackground = new Sprite(imgBackground);
spriteBackground.setPosition(0, 0);
spriteBackground.setAlpha(0.7f);
Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceSurvival");
String names = prefs.getString("names", null);
if (names == null) {
// prefs.putString("names", "Astro");
names = "Astro,";
}
String scores = prefs.getString("highscores", null);
if (scores == null) {
// prefs.putString("highscores", "10000");
scores = "10000,";
}
Table table = new Table(skin);
table.defaults().pad(10f);
table.setFillParent(true);
table.setPosition(table.getX(), table.getY() + 250);
/**
* Se hace el titulo de scores
*/
/**
* Se crean las columnas con puntuajes
*/
Label columnName;
Label columnScore;
String[] allScores = scores.split(",");
String[] allNames = names.split(",");
int i = 0;
table.row();
for (String name : allNames) {
columnName = new Label(name + ": ", skin);
columnName.setFontScale(3f, 3f);
table.add(columnName);
columnScore = new Label(allScores[i], skin);
columnScore.setFontScale(3f, 3f);
table.add(columnScore);
i++;
table.row();
}
// Boton Return
TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
ImageButton btnReturn = new ImageButton(trdReturn);
btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
// Click en boton Return
btnReturn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
main.setScreen(new PantallaMenu(main));
}
});
stageMenu.addActor(table);
stageMenu.addActor(btnReturn);
Gdx.input.setInputProcessor(stageMenu);
}
Aggregations