Package com.badlogic.gdx.scenes.scene2d.utils

Examples of com.badlogic.gdx.scenes.scene2d.utils.ClickListener


        Label title = new Label("JFIGHTER2DX\nMAIN MENU", game.getSkin());
        title.setFontScale(2.5f);

        TextButton quickButton = new TextButton("QUICK PLAY", game.getSkin());
        quickButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(new GameScreen(game, GameType.QUICK));
            }
        });
        TextButton historyButton = new TextButton("PLAY HISTORY", game.getSkin());
        historyButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(new GameScreen(game, GameType.HISTORY));
            }
        });
        TextButton optionsButton = new TextButton("OPTIONS", game.getSkin());
        optionsButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(new ConfigurationScreen(game));

            }
        });
        TextButton exitButton = new TextButton("QUIT GAME", game.getSkin());
        exitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                System.exit(0);
            }
        });
View Full Code Here


        table.add(labelScore).center().pad(5f);

        // El usuario ya ha rellenado su nombre
        if (done) {
            TextButton quitButton = new TextButton("MAIN MENU", game.getSkin());
            quitButton.addListener(new ClickListener() {
                public void touchUp(InputEvent event, float x, float y, int pointer, int button) {

                    game.setScreen(new MainMenuScreen(game));
                }
            });

            table.row().height(70);
            table.add(quitButton).center().width(300).pad(5f);
        }
        else {
            // El usuario aún no he escrito su nombre
            final TextField nameTextField = new TextField("TYPE YOUR NAME", game.getSkin());

            TextButton quitButton = new TextButton("OK", game.getSkin());
            quitButton.addListener(new ClickListener() {
                public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                    ConfigurationManager.addScores(nameTextField.getText(), game.score);
                    stage.clear();
                    done = true;
                    loadScreen();
View Full Code Here

        Label title = new Label("JFIGHTER2DX\nSETTINGS", game.getSkin());
        title.setFontScale(2.5f);

        final CheckBox checkSound = new CheckBox(" SOUND", game.getSkin());
        checkSound.setChecked(prefs.getBoolean("sound"));
        checkSound.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {

                prefs.putBoolean("sound", checkSound.isChecked());
            }
        });

        Label difficultyLabel = new Label("-- DIFFICULTY --", game.getSkin());

        String[] resolutionsArray = {"LOW", "MEDIUM", "HIGH"};
        final List difficultyList = new List(resolutionsArray, game.getSkin());

        difficultyList.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {

                switch (difficultyList.getSelectedIndex()) {
                    case 0:
                        prefs.putString("difficulty", "low");
                        break;
                    case 1:
                        prefs.putString("difficulty", "medium");
                        break;
                    case 2:
                        prefs.putString("difficulty", "high");
                        break;
                    default:
                }
            }
        });

        TextButton exitButton = new TextButton("MAIN MENU", game.getSkin());
        exitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                prefs.flush();
                dispose();
                game.setScreen(new MainMenuScreen(game));
            }
View Full Code Here

    initialize();
  }

  private void initialize () {
    setTouchable(Touchable.enabled);
    addListener(clickListener = new ClickListener() {
      public void clicked (InputEvent event, float x, float y) {
        if (isDisabled) return;
        setChecked(!isChecked);
      }
    });
View Full Code Here

    setHeight(getPrefHeight());
    initialize();
  }

  private void initialize () {
    addListener(inputListener = new ClickListener() {
      public void clicked (InputEvent event, float x, float y) {
        if (getTapCount() > 1) setSelection(0, text.length());
      }

      public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
View Full Code Here

    setStyle(style);
    initialize();
  }

  private void initialize () {
    addListener(clickListener = new ClickListener() {
      private boolean isCtrlPressed () {
        if (isMac)
          return Gdx.input.isKeyPressed(Keys.SYM);
        else
          return Gdx.input.isKeyPressed(Keys.CONTROL_LEFT) || Gdx.input.isKeyPressed(Keys.CONTROL_RIGHT);
View Full Code Here

    setStyle(style);
    setItems(items);
    setWidth(getPrefWidth());
    setHeight(getPrefHeight());

    addListener(clickListener = new ClickListener() {
      public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
        if (pointer == 0 && button != 0) return false;
        if (disabled) return false;
        Stage stage = getStage();
        if (list == null) list = new SelectList();
View Full Code Here

        Label title = new Label("JUMPER2DX", game.getSkin());
        title.setFontScale(2.5f);

        TextButton quickButton = new TextButton("RESUME", game.getSkin());
        quickButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(gameScreen);
            }
        });
        TextButton historyButton = new TextButton("RETURN TO MAIN MENU", game.getSkin());
        historyButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                gameScreen.dispose();
                game.setScreen(new MainMenuScreen(game));
            }
        });
        TextButton exitButton = new TextButton("QUIT GAME", game.getSkin());
        exitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                System.exit(0);
            }
        });
View Full Code Here

        Label title = new Label("JUMPER2DX\nMAIN MENU", game.getSkin());
        title.setFontScale(2.5f);

        TextButton playButton = new TextButton("PLAY GAME", game.getSkin());
        playButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                //dispose();
                game.setScreen(new GameScreen(game));
            }
        });
        TextButton optionsButton = new TextButton("OPTIONS", game.getSkin());
        optionsButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                // FIXME ¿Menú de opciones?

            }
        });
        TextButton exitButton = new TextButton("QUIT GAME", game.getSkin());
        exitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                System.exit(0);
            }
        });
View Full Code Here

    setSize(getPrefWidth(), getPrefHeight());

    scroll = new ListScroll();
    selection = scroll.list.getSelection();

    addListener(clickListener = new ClickListener() {
      public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
        if (pointer == 0 && button != 0) return false;
        if (disabled) return false;
        showList();
        return true;
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.scenes.scene2d.utils.ClickListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.