Example #1
0
  public void drawScene() {
    GLDrawer.clear();
    Board currentBoard = Crissaegrim.getCurrentBoard();

    if (Crissaegrim.getCurrentBoard() != null) {
      GameInitializer.initializeNewFrameForWindow();
      ClientBoard.drawBackground(currentBoard);

      GameInitializer.initializeNewFrameForScene();
      ClientBoard.draw(currentBoard, TileLayer.BACKGROUND);
      ClientBoard.draw(currentBoard, TileLayer.MIDDLEGROUND);
      for (Doodad doodad : currentBoard.getDoodads().values()) {
        if (!Crissaegrim.getDebugMode()) {
          doodad.draw();
        } else {
          doodad.drawDebugMode();
        }
      }
      drawLocalDroppedItems();
      Crissaegrim.getPlayer().draw();
      if (Crissaegrim.getDebugMode()) {
        Crissaegrim.getPlayer().drawDebugMode();
      }
      drawGhosts();
      ClientBoard.draw(currentBoard, TileLayer.FOREGROUND);
      drawParticleSystems();
    }

    GameInitializer.initializeNewFrameForWindow();
    Crissaegrim.getPlayer().getInventory().draw();
    while (!waitingChatMessages.isEmpty()) {
      Crissaegrim.getChatBox().addChatMessage(waitingChatMessages.remove(0));
    }
    Crissaegrim.getChatBox().draw();
  }
Example #2
0
 private void drawLoadingMessage() {
   GameInitializer.initializeNewFrameForWindow();
   // Loading message texture size is 372 x 64
   GLDrawer.useTexture(Textures.LOADING_MESSAGE);
   GLDrawer.drawQuad(
       32, 404, Crissaegrim.getWindowHeight() - 96, Crissaegrim.getWindowHeight() - 32);
 }
Example #3
0
  /**
   * Displays one of the message textures made in MSPaint until the client is closed.
   *
   * @param texture The texture id of the message to display
   * @param width The width of the texture
   * @param height The height of the texture
   * @param optionalTitleChange This message will be shown on the title bar. A {@code null} or empty
   *     string will be ignored.
   * @throws InterruptedException
   */
  public void displayMessageForever(int texture, int width, int height, String optionalTitleChange)
      throws InterruptedException {
    if (optionalTitleChange != null && !optionalTitleChange.trim().isEmpty()) {
      GameInitializer.setWindowTitle(optionalTitleChange);
    }
    while (!Display.isCloseRequested()) {
      GameInitializer.initializeNewFrameForWindow();
      GLDrawer.clear();
      GLDrawer.useTexture(texture);
      GLDrawer.drawQuad(
          32,
          32 + width,
          Crissaegrim.getWindowHeight() - 32 - height,
          Crissaegrim.getWindowHeight() - 32);

      Display.update();
      Thread.sleep(100);
    }
    Display.destroy();
  }
Example #4
0
 private void drawLoadingProgressBar() {
   if (Crissaegrim.numPacketsToReceive != 0) {
     // Loading message texture size is 372 x 64, so use that width...
     double amtLoaded =
         (double) Crissaegrim.numPacketsReceived / (double) Crissaegrim.numPacketsToReceive;
     int progressBarRight = (int) (((1.0 - amtLoaded) * 32.0) + (amtLoaded * 404));
     GameInitializer.initializeNewFrameForWindow();
     GLDrawer.disableTextures();
     GLDrawer.setColor(0.15, 0.45, 0.15);
     GLDrawer.drawQuad(
         32,
         progressBarRight,
         Crissaegrim.getWindowHeight() - 136,
         Crissaegrim.getWindowHeight() - 106);
     GLDrawer.setColor(0.66, 0.66, 0.66);
     GLDrawer.setLineWidth(2);
     GLDrawer.drawOutline(
         32, 404, Crissaegrim.getWindowHeight() - 136, Crissaegrim.getWindowHeight() - 106);
     GLDrawer.setLineWidth(1);
   }
 }
Example #5
0
  private void drawPlayerHealthBar() {
    int healthBarRight = Crissaegrim.getWindowWidth() - 10;
    int healthBarLeft = healthBarRight - 120;
    int healthBarBottom = 10;
    int healthBarTop = healthBarBottom + 25;
    double amtHealth = Crissaegrim.getPlayer().getHealthBar().getAmtHealth();
    int healthBarMiddle =
        (int) (((1.0 - amtHealth) * healthBarLeft) + (amtHealth * healthBarRight));

    GameInitializer.initializeNewFrameForWindow();
    GLDrawer.disableTextures();
    GLDrawer.setColor(0.812, 0.188, 0.188);
    GLDrawer.drawQuad(
        healthBarLeft, healthBarRight, healthBarBottom, healthBarTop); // Draw red backing
    GLDrawer.setColor(0.102, 0.533, 0.227);
    GLDrawer.drawQuad(
        healthBarLeft, healthBarMiddle, healthBarBottom, healthBarTop); // Draw green remaining
    GLDrawer.setColor(0.686, 0.741, 0.686);
    GLDrawer.setLineWidth(2);
    GLDrawer.drawOutline(
        healthBarLeft, healthBarRight, healthBarBottom, healthBarTop); // Draw outline
    GLDrawer.setLineWidth(1);
  }