예제 #1
0
 private void drawMouseHoverStatus() {
   Coordinate mouseCoords = getCoordinatesForMouse();
   String players = "";
   synchronized (Crissaegrim.getPlayerGhosts()) {
     for (EntityStatus ghost : Crissaegrim.getPlayerGhosts().values()) {
       Coordinate ghostCoordinate = new Coordinate(ghost.getXPos(), ghost.getYPos());
       Rect playerBounds = RectUtils.getPlayerBoundingRect(ghostCoordinate);
       RectUtils.expandRect(playerBounds, 0.6);
       if (RectUtils.coordinateIsInRect(mouseCoords, playerBounds)) {
         players += ", " + ghost.getName();
       }
     }
   }
   if (!players.isEmpty()) {
     TextTexture mouseHoverStatus =
         Crissaegrim.getCommonTextures().getTextTexture(players.substring(2));
     int top = Crissaegrim.getWindowHeight() - 5;
     GLDrawer.useTexture(mouseHoverStatus.getTextureId());
     GLDrawer.drawQuad(5, 5 + mouseHoverStatus.getWidth(), top - 20, top);
   }
 }
예제 #2
0
  private void drawGhost(EntityStatus ghost) {
    // TODO: Don't draw if off-screen!
    boolean facingRight = ghost.getFacingRight();
    double xPos = ghost.getXPos();
    double yPos = ghost.getYPos();
    double textureHalfWidth = ghost.getTextureHalfWidth();
    double textureHeight = ghost.getTextureHeight();
    double left = xPos - textureHalfWidth;
    double right = xPos + textureHalfWidth;
    GLDrawer.useTexture(ghost.getCurrentTexture());
    GLDrawer.drawQuad(
        (facingRight ? left : right), (facingRight ? right : left), yPos, yPos + textureHeight);

    Entity.drawMiniHealthBar(xPos, yPos + textureHeight, ghost.getAmtHealth());
  }