Beispiel #1
0
  public void init() {
    try {
      initVertexBuffer();
      initShader();
      initTextures();

      font = new TrueTypeFont("font/computer_pixel-7.ttf", 42f);
      fontBig = new TrueTypeFont("font/computer_pixel-7.ttf", 80f);
      font.init();
      fontBig.init();
    } catch (Exception e) {
      log.error("Initialization failed!", e);
    }

    GLHelper.checkAndThrow();
  }
Beispiel #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);
  }