Exemplo n.º 1
0
  public void onDraw(double elapsedMillis, GameArena arena, Level gameLevel) {
    glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_ENABLE_BIT);
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    drawPlayerIcons(gameLevel.getPlayer(), elapsedMillis);

    drawLabels(elapsedMillis, arena, gameLevel);

    GLHelper.checkAndThrow();

    glPopAttrib();
  }
Exemplo n.º 2
0
  private void drawLabels(double elapsedMillis, GameArena arena, Level gameLevel) {

    switch (gameLevel.getState()) {
      case NotStarted:
        fontBig.printInScreen(
            HorizontalAlignment.Center, 0, 500, "Kirkwood Blaster", windowWidth, windowHeight);
        font.printInScreen(
            HorizontalAlignment.Center,
            0,
            540,
            "Get ready to rumble...",
            windowWidth,
            windowHeight);
        break;
      case Running:
        final GameDuration duration = gameLevel.getGameDuration();
        font.printOnScreen(50, 50, duration.toString(), windowWidth, windowHeight);
        break;
      case Paused:
        fontBig.printInScreen(
            HorizontalAlignment.Center, 0, 500, "Kirkwood Blaster", windowWidth, windowHeight);
        font.printInScreen(
            HorizontalAlignment.Center,
            0,
            540,
            "Pause - Place your Hand above the leap",
            windowWidth,
            windowHeight);
        break;
      case GameOver:
        fontBig.printInScreen(
            HorizontalAlignment.Center, 0, 500, "GameOver", windowWidth, windowHeight);
        fontBig.printInScreen(
            HorizontalAlignment.Center,
            0,
            540,
            "Your score: " + gameLevel.getPlayer().getScore(),
            windowWidth,
            windowHeight);
        break;
      case Completed:
        fontBig.printInScreen(
            HorizontalAlignment.Center,
            0,
            500,
            "Gongratiulations! Level clear",
            windowWidth,
            windowHeight);
        fontBig.printInScreen(
            HorizontalAlignment.Center,
            0,
            540,
            "Your score: " + gameLevel.getPlayer().getScore(),
            windowWidth,
            windowHeight);
        break;
    }

    font.printInScreen(
        HorizontalAlignment.Right,
        50f,
        50f,
        gameLevel.getPlayer().getScoreString(),
        windowWidth,
        windowHeight);
  }