Exemplo n.º 1
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);
  }
 public GameResource toResource(Game game) {
   GameResource resource = createResourceWithId(game.getId(), game);
   resource.status = game.getStatus();
   resource.add(linkTo(GamesController.class).slash(game).slash("doors").withRel("doors"));
   return resource;
 }