コード例 #1
0
ファイル: ZedSurvivor.java プロジェクト: faijdherbe/LD22
  @Override
  public void renderHUD(Graphics2D g) {
    // TODO Auto-generated method stub
    super.renderHUD(g);

    g.drawImage(HUDBg, 0, 0, null);

    if (player.weapon != null) {

      g.drawImage(player.weapon.getHUDImage(), 123, 121, null);

      float wh = (player.weapon.bulletsLeft / (float) player.weapon.bulletsCapacity);
      drawHealth(g, wh, 121, 137, 36, 4);
    }

    // player health
    drawHealth(g, player.health / (float) player.maxHealth, 3, 137, 36, 4);

    Font f = g.getFont();
    g.setColor(Color.black);
    g.setFont(f.deriveFont(4));
    Text.drawText(g, String.format("%05d", score), 130, 5);

    Text.drawText(
        g, String.format("Day: %d", (int) Math.ceil(realtime / (float) secondsPerDay)), 66, 136);

    if (menu != null) {
      menu.render(g);
    }
  }
コード例 #2
0
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   super.render(gc, sbg, g);
   multiLb.render(gc, g);
   textField.render(gc, g);
 }