Ejemplo n.º 1
0
  @Override
  public void show() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    table = new Table();
    table.setFillParent(true);
    // table.row();
    table.right();

    mainInit();
    buttonInit();

    stage.addActor(table);
  }
Ejemplo n.º 2
0
  private void buttonInit() {
    Button newGameButton;
    Button.ButtonStyle buttonStyle;

    buttonStyle = new Button.ButtonStyle();
    buttonStyle.up = GameResource.getInstance().getDrawable("new_button");
    buttonStyle.down = GameResource.getInstance().getDrawable("new_button_pressed");
    newGameButton = new Button(buttonStyle);
    newGameButton.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            music.stop();
            currentGame.setScreen(currentGame.gameScreen);
            // currentGame.setScreen(currentGame.loadingScreen);
          }
        });

    Button loadGameButton;
    buttonStyle = new Button.ButtonStyle();
    buttonStyle.up = GameResource.getInstance().getDrawable("load_button");
    buttonStyle.down = GameResource.getInstance().getDrawable("load_button_pressed");
    loadGameButton = new Button(buttonStyle);
    loadGameButton.addListener(
        new InputListener() {
          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            // load logic
          }
        });

    table.add(newGameButton).padRight(80).padBottom(20).width(150).height(70);
    table.row();
    table.add(loadGameButton).padRight(80).width(150).height(70);
  }
Ejemplo n.º 3
0
  public MainMenuScreen(LD33 game) {
    this.game = game;
    bgCam = new OrthographicCamera(1, 1);
    stage = new Stage(new FitViewport(400, 300));

    Skin skin = game.assetMngr.get("skin.json", Skin.class);

    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    Label title = new Label("Where-Wolf", skin);
    title.setFontScale(4);
    table.add(title).pad(50);
    table.row();

    TextButton startB = new TextButton("Start", skin);
    startB.setDisabled(true);
    startB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(new PlayScreen(MainMenuScreen.this.game, 1));
            dispose();
            return true;
          }
        });
    table.add(startB).pad(1f).width(96);
    table.row();

    TextButton levelB = new TextButton("Select level", skin);
    levelB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(
                new LevelsScreen(MainMenuScreen.this.game, MainMenuScreen.this));
            return true;
          }
        });
    levelB.setDisabled(true);
    table.add(levelB).pad(1f).width(96);
    table.row();

    TextButton controlB = new TextButton("Controls", skin);
    controlB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(
                new ControlsScreen(MainMenuScreen.this.game, MainMenuScreen.this));
            return true;
          }
        });
    controlB.setDisabled(true);
    table.add(controlB).pad(1f).width(96);
    table.row();

    TextButton exitB = new TextButton("Exit", skin);
    exitB.setDisabled(true);
    exitB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            Gdx.app.exit();
            return true;
          }
        });
    if (Gdx.app.getType() != Application.ApplicationType.WebGL) table.add(exitB).pad(1f).width(96);
  }