Search in sources :

Example 1 with Texto

use of mx.itesm.another_monkey_paradox.Utils.Texto in project AnotherMonekyParadox by SantiagoMille.

the class PantallaCredits method crearMenu.

private void crearMenu() {
    stageMenu = new Stage(vista);
    boolAdr = false;
    boolFer = false;
    boolBri = false;
    boolDie = false;
    boolSan = false;
    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);
    Itesm = new Texto(1, 1, 1);
    imgBackground = new Texture("space.png");
    adrian = new Texture("pp_a.PNG");
    santi = new Texture("pp_s.PNG");
    fernando = new Texture("pp.PNG");
    diego = new Texture("pp_d.PNG");
    brian = new Texture("pp_b.PNG");
    logoTec = new Texture("logoTec.png");
    spriteBackground = new Sprite(imgBackground);
    tec = new Sprite(logoTec);
    tec.setPosition(ANCHO * 0.85f - 40, 95);
    TextureRegionDrawable trdSan = new TextureRegionDrawable(new TextureRegion(santi));
    san = new ImageButton(trdSan);
    san.setPosition(0, ALTO - 280 + 48);
    san.addAction(Actions.alpha(0));
    san.addAction(Actions.moveTo(800, ALTO - 280 + 48, 0.8f));
    san.addAction(Actions.fadeIn(0.8f));
    san.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            boolSan = true;
        }
    });
    TextureRegionDrawable trdBri = new TextureRegionDrawable(new TextureRegion(brian));
    bri = new ImageButton(trdBri);
    bri.setPosition(0, ALTO - 400 + 48);
    bri.addAction(Actions.alpha(0));
    bri.addAction(Actions.moveTo(800, ALTO - 400 + 48, 0.8f));
    bri.addAction(Actions.fadeIn(0.8f));
    bri.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            boolBri = true;
        }
    });
    TextureRegionDrawable trdFer = new TextureRegionDrawable(new TextureRegion(fernando));
    fer = new ImageButton(trdFer);
    fer.setPosition(0, ALTO - 520 + 48);
    fer.addAction(Actions.alpha(0));
    fer.addAction(Actions.moveTo(800, ALTO - 520 + 48, 0.8f));
    fer.addAction(Actions.fadeIn(0.8f));
    fer.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            boolFer = true;
        }
    });
    TextureRegionDrawable trdAdr = new TextureRegionDrawable(new TextureRegion(adrian));
    adr = new ImageButton(trdAdr);
    adr.setPosition(0, ALTO - 640 + 48);
    adr.addAction(Actions.alpha(0));
    adr.addAction(Actions.moveTo(800, ALTO - 640 + 48, 0.8f));
    adr.addAction(Actions.fadeIn(0.8f));
    adr.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            boolAdr = true;
        }
    });
    TextureRegionDrawable trdDie = new TextureRegionDrawable(new TextureRegion(diego));
    die = new ImageButton(trdDie);
    die.setPosition(0, ALTO - 760 + 48);
    die.addAction(Actions.alpha(0));
    die.addAction(Actions.moveTo(800, ALTO - 760 + 48, 0.8f));
    die.addAction(Actions.fadeIn(0.8f));
    die.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            boolDie = true;
        }
    });
    // 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);
    stageMenu.addActor(san);
    stageMenu.addActor(bri);
    stageMenu.addActor(fer);
    stageMenu.addActor(adr);
    stageMenu.addActor(die);
    Gdx.input.setInputProcessor(stageMenu);
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Texto(mx.itesm.another_monkey_paradox.Utils.Texto) Texture(com.badlogic.gdx.graphics.Texture) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 2 with Texto

use of mx.itesm.another_monkey_paradox.Utils.Texto in project AnotherMonekyParadox by SantiagoMille.

the class PantallaDeveloper method crearMenu.

private void crearMenu() {
    stageMenu = new Stage(vista);
    prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
    musicOn = prefs.getBoolean("music", true);
    dif = prefs.getFloat("Difficulty");
    sen = prefs.getFloat("Sensitivity");
    Skin skin = new Skin(Gdx.files.internal("skin/comic-ui.json"));
    imgBackground = new Texture("pantalla_config2.png");
    spriteBackground = new Sprite(imgBackground);
    spriteBackground.setAlpha(0.55f);
    // Boton Return
    TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
    ImageButton btnReturn = new ImageButton(trdReturn);
    btnReturn.setPosition(20, 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);
            difficulty = sliderDif.getPercent();
            sensitivity = sliderSens.getPercent();
            prefs.putFloat("Difficulty", difficulty);
            prefs.putFloat("Sensitivity", sensitivity);
            prefs.flush();
            main.setScreen(new PantallaMenu(main));
        }
    });
    // Boton Play
    trdMusicPressed = new TextureRegionDrawable(new TextureRegion(new Texture("mute.png")));
    trdMusic = new TextureRegionDrawable(new TextureRegion(new Texture("audio.png")));
    btnPlay = new ImageButton(trdMusic);
    btnPlayPressed = new ImageButton(trdMusicPressed);
    if (musicOn) {
        btnPlayPressed.setVisible(false);
        btnPlay.setVisible(true);
    } else {
        btnPlayPressed.setVisible(true);
        btnPlay.setVisible(false);
    }
    btnPlay.setSize(100, 100);
    btnPlayPressed.setSize(100, 100);
    btnPlay.setPosition(ANCHO - btnPlay.getWidth() - 30, ALTO - btnPlay.getHeight() - 20);
    btnPlayPressed.setPosition(ANCHO - btnPlay.getWidth() - 30, ALTO - btnPlay.getHeight() - 20);
    // Click en boton Play
    btnPlay.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            musicOn = false;
            prefs.putBoolean("music", false);
            prefs.flush();
            btnPlayPressed.setVisible(true);
            btnPlay.setVisible(false);
        }
    });
    // Click en boton Play
    btnPlayPressed.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            musicOn = true;
            prefs.putBoolean("music", true);
            prefs.flush();
            btnPlayPressed.setVisible(false);
            btnPlay.setVisible(true);
        }
    });
    titulo = new Texto(1, 1, 1);
    Texture diff = new Texture("button_difficulty.png");
    diffi = new Sprite(diff);
    diffi.setPosition(ANCHO / 2 - 110 - diffi.getWidth(), ALTO / 2);
    sliderDif = new Slider(0, 100, 1, false, skin);
    sliderDif.setValue(dif * 100);
    sliderDif.setPosition(diffi.getX() + 100, ALTO / 3);
    sliderDif.setScale(2);
    Texture sens = new Texture("button_sensitivity.png");
    sensi = new Sprite(sens);
    sensi.setPosition(ANCHO / 2 + 110, ALTO / 2);
    sliderSens = new Slider(0, 100, 1, false, skin);
    sliderSens.setValue(sen * 100);
    sliderSens.setPosition(sensi.getX() + 100, ALTO / 3);
    sliderSens.setScale(2);
    TextureRegionDrawable creditsTRD = new TextureRegionDrawable(new TextureRegion(new Texture("button_credits.png")));
    ImageButton btnCreds = new ImageButton(creditsTRD);
    btnCreds.setPosition(ANCHO - 20 - btnCreds.getWidth(), 20);
    btnCreds.addListener(new ChangeListener() {

        public void changed(ChangeEvent event, Actor actor) {
            difficulty = sliderDif.getPercent();
            sensitivity = sliderSens.getPercent();
            prefs.putFloat("Difficulty", difficulty);
            prefs.putFloat("Sensitivity", sensitivity);
            prefs.flush();
            main.setScreen(new PantallaCredits(main));
        }
    });
    stageMenu.addActor(btnCreds);
    stageMenu.addActor(btnPlay);
    stageMenu.addActor(btnPlayPressed);
    stageMenu.addActor(sliderDif);
    stageMenu.addActor(sliderSens);
    stageMenu.addActor(btnReturn);
    Gdx.input.setInputProcessor(stageMenu);
}
Also used : Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Texture(com.badlogic.gdx.graphics.Texture) Texto(mx.itesm.another_monkey_paradox.Utils.Texto) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Actor(com.badlogic.gdx.scenes.scene2d.Actor) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 3 with Texto

use of mx.itesm.another_monkey_paradox.Utils.Texto in project AnotherMonekyParadox by SantiagoMille.

the class PantallaScoresStory 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"));
    Skin skin = new Skin(Gdx.files.internal("skin5/star-soldier-ui.json"));
    // Skin skin = new Skin(Gdx.files.internal("skin2/glassy-ui.json"));
    Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceStory");
    String score = prefs.getString("highscores", null);
    ArrayList<String> scoress = new ArrayList<String>();
    if (score == null) {
        // prefs.putString("highscores", "10000");
        scoress.add("Astro:10000");
    } else {
        for (String s : score.split(",")) {
            if (s.length() > 1) {
                scoress.add(s);
            }
        }
    }
    Table table = new Table(skin);
    table.defaults().pad(10f);
    table.setFillParent(true);
    table.setPosition(table.getX(), table.getY() + 130);
    /**
     * Se crean las columnas con puntuajes
     */
    Label columnName;
    Label columnScore;
    ArrayList<String> allScores = new ArrayList<String>();
    ArrayList<String> allNames = new ArrayList<String>();
    for (String s : scoress) {
        allScores.add(s.split(":")[1]);
        allNames.add(s.split(":")[0]);
    }
    int i = 0;
    // table.add(scoresTitle).colspan(2).fillX().height(150);
    table.row();
    for (String name : allNames) {
        columnName = new Label(name + ": ", skin);
        columnName.setFontScale(1.5f, 1.5f);
        table.add(columnName);
        columnScore = new Label(allScores.get(i), skin);
        columnScore.setFontScale(1.5f, 1.5f);
        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);
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) ArrayList(java.util.ArrayList) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Texto(mx.itesm.another_monkey_paradox.Utils.Texto) Texture(com.badlogic.gdx.graphics.Texture) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Preferences(com.badlogic.gdx.Preferences) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 4 with Texto

use of mx.itesm.another_monkey_paradox.Utils.Texto 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"));
    Skin skin = new Skin(Gdx.files.internal("skin5/star-soldier-ui.json"));
    // Skin skin = new Skin(Gdx.files.internal("skin2/glassy-ui.json"));
    Preferences prefs = Gdx.app.getPreferences("AnotherMonkeyPreferenceSurvival");
    String score = prefs.getString("highscores", null);
    ArrayList<String> scoress = new ArrayList<String>();
    if (score == null) {
        // prefs.putString("highscores", "10000");
        scoress.add("Astro:10000");
    } else {
        for (String s : score.split(",")) {
            if (s.length() > 1) {
                scoress.add(s);
            }
        }
    }
    Table table = new Table(skin);
    table.defaults().pad(10f);
    table.setFillParent(true);
    table.setPosition(table.getX(), table.getY() + 130);
    /**
     * Se crean las columnas con puntuajes
     */
    Label columnName;
    Label columnScore;
    ArrayList<String> allScores = new ArrayList<String>();
    ArrayList<String> allNames = new ArrayList<String>();
    for (String s : scoress) {
        allScores.add(s.split(":")[1]);
        allNames.add(s.split(":")[0]);
    }
    int i = 0;
    // table.add(scoresTitle).colspan(2).fillX().height(150);
    table.row();
    for (String name : allNames) {
        columnName = new Label(name + ": ", skin);
        columnName.setFontScale(1.5f, 1.5f);
        table.add(columnName);
        columnScore = new Label(allScores.get(i), skin);
        columnScore.setFontScale(1.5f, 1.5f);
        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);
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) ArrayList(java.util.ArrayList) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) Texto(mx.itesm.another_monkey_paradox.Utils.Texto) Texture(com.badlogic.gdx.graphics.Texture) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Preferences(com.badlogic.gdx.Preferences) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 5 with Texto

use of mx.itesm.another_monkey_paradox.Utils.Texto in project AnotherMonekyParadox by SantiagoMille.

the class EscenaAstroGanador method crearBoton.

private void crearBoton() {
    // Boton Home
    assetManager.load("boton Home.png", Texture.class);
    assetManager.finishLoading();
    imgBoton = assetManager.get("boton Home.png");
    stageNivel = new Stage(vista);
    texto1 = new Texto(1, 1, 1);
    texto2 = new Texto(1, 1, 1);
    TextureRegionDrawable btnHome = new TextureRegionDrawable(new TextureRegion(imgBoton));
    home = new ImageButton(btnHome);
    home.setSize(155, 155);
    home.setPosition(ANCHO * 2 / 10, ALTO / 2);
    home.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            main.setScreen(new PantallaSplash(main));
        }
    });
    // Boton Next
    assetManager.load("PlayButton.png", Texture.class);
    assetManager.finishLoading();
    imgBN = assetManager.get("PlayButton.png");
    TextureRegionDrawable btnNext = new TextureRegionDrawable(new TextureRegion(imgBN));
    next = new ImageButton(btnNext);
    next.setSize(155, 155);
    next.setPosition(ANCHO * 7 / 10, ALTO / 2);
    next.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            if (nivel == 2) {
                main.setScreen(new PantallaCinematica(main, "Cinematicas/C N1.png", 2, score, vidas, granadas));
            } else if (nivel == 3) {
                main.setScreen(new PantallaCinematica(main, "Cinematicas/C N2.png", 3, score, vidas, granadas));
            } else if (nivel == 4) {
                main.setScreen(new PantallaCinematica(main, "Cinematicas/C N3W.png", 4, score, vidas, granadas));
            } else if (nivel == 44) {
                main.setScreen(new PantallaCinematica(main, "Cinematicas/C N4.png", 44, score, vidas, granadas));
            }
        }
    });
    stageNivel.addActor(home);
    stageNivel.addActor(next);
    Gdx.input.setInputProcessor(stageNivel);
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) PantallaSplash(mx.itesm.another_monkey_paradox.PantallasDeCarga.PantallaSplash) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Texto(mx.itesm.another_monkey_paradox.Utils.Texto) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)6 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)6 Stage (com.badlogic.gdx.scenes.scene2d.Stage)6 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)6 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)6 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)6 Texto (mx.itesm.another_monkey_paradox.Utils.Texto)6 Texture (com.badlogic.gdx.graphics.Texture)4 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)4 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)3 Preferences (com.badlogic.gdx.Preferences)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)2 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)2 ArrayList (java.util.ArrayList)2 PantallaSplash (mx.itesm.another_monkey_paradox.PantallasDeCarga.PantallaSplash)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 Slider (com.badlogic.gdx.scenes.scene2d.ui.Slider)1 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)1 PantallaCargandoStoryMode (mx.itesm.another_monkey_paradox.PantallasDeCarga.PantallaCargandoStoryMode)1