예제 #1
0
  @Override
  public void update(float deltaTime) {
    Graphics g = game.getGraphics();
    List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
    game.getInput().getKeyEvents();

    int len = touchEvents.size();
    for (int i = 0; i < len; i++) {
      TouchEvent event = touchEvents.get(i);
      if (event.type == TouchEvent.TOUCH_UP) {
        if (inBounds(event, 0, g.getHeight() - 64, 64, 64)) {
          Settings.soundEnabled = !Settings.soundEnabled;
          if (Settings.soundEnabled) Assets.click.play(1);
        }
        if (inBounds(event, 64, 220, 192, 42)) {
          game.setScreen(new GameScreen(game));
          if (Settings.soundEnabled) Assets.click.play(1);
          return;
        }
        if (inBounds(event, 64, 220 + 42, 192, 42)) {
          game.setScreen(new HighscoreScreen(game));
          if (Settings.soundEnabled) Assets.click.play(1);
          return;
        }
        if (inBounds(event, 64, 220 + 84, 192, 42)) {
          game.setScreen(new HelpScreen(game));
          if (Settings.soundEnabled) Assets.click.play(1);
          return;
        }
      }
    }
  }
예제 #2
0
  @Override
  public void present(float deltaTime) {
    Graphics g = game.getGraphics();

    g.drawImage(Assets.background, 0, 0);
    g.drawImage(Assets.logo, 32, 20);
    g.drawImage(Assets.mainMenu, 64, 220);
    if (Settings.soundEnabled) g.drawImage(Assets.buttons, 0, 416, 0, 0, 64, 64);
    else g.drawImage(Assets.buttons, 0, 416, 64, 0, 64, 64);
  }