unit uGUI;

{$mode delphi}

interface

uses
  Classes, SysUtils;

var
  h_max_live  : integer = 3;
  h_max_sh    : integer = 2;
  h_max_mana  : integer = 3;
  h_max_exp   : integer = 4;
  h_max_sword : integer = 3;

  h_live  : integer = 3;
  h_sh    : integer = 2;
  h_mana  : integer = 3;
  h_exp   : integer = 0;
  h_sword : integer = 3;

  hm_live  : integer = 1;
  hm_sh    : integer = 1;
  hm_mana  : integer = 1;
  hm_exp   : integer = 1;
  hm_sword : integer = 1;

  //
  show_e : Boolean = false;

  e_max_live  : integer = 5;
  e_max_heart : integer = 5;

  e_live  : integer = 4;
  em_live : integer = 4;

  e_heart  : integer = 5;
  em_heart : integer = 1;

  e_sword : integer = 3;

procedure gui_draw;

implementation
uses
  uGlobal, zglHeader;

procedure gui_draw;
var
  X, X1, Y : Integer;
begin
  // Live
  sgui_live.Draw(12, 8, 0);
  for X := 1 to h_max_live do
  begin
    sgui_live.Draw(0 + X * 24, 8, 1);
    sgui_live_e.Draw(0 + X * 24, 8, 0);
  end;
  for X := 1 to h_live do
    sgui_live_e.Draw(0 + X * 24, 8, 1);

  X1 := 0 + h_max_live * 24;
  // Sh
  if h_max_sh > 0 then
  begin
    sgui_sh.Draw(X1 + 24, 8, 1);
    sgui_live.Draw(X1 + 24, 8, 2);
    //sgui_sh.Draw(X1 + 24, 8, 0);
    X1 := X1 + 12;
    for X := 1 to h_max_sh do
    begin
      sgui_sh.Draw(X1 + X * 24, 8, 1);
      sgui_sh_e.Draw(X1 + X * 24, 8, 0);
    end;
    for X := 1 to h_sh do
      sgui_sh_e.Draw(X1 + X * 24, 8, 1);

    X1 := X1 + h_max_sh * 24;
    sgui_sh.Draw(X1 + 24, 8, 2);
  end
  else
    sgui_live.Draw(X1 + 24, 8, 2);

  // Mana
  sgui_mana.Draw(16, 8 + 32, 0);
  sgui_mana.Draw(34, 8 + 32, 1);
  for X := 1 to h_max_mana do
  begin
    sgui_mana.Draw(34 + X * 20, 8 + 32, 1);
    sgui_mana_e.Draw(38 + X * 20, 8 + 32, 0);
  end;
  for X := 1 to h_mana do
    sgui_mana_e.Draw(38 + X * 20, 8 + 32, 1);

  X1 := 34 + h_max_mana * 20;
  sgui_mana.Draw(X1 + 20, 8 + 32, 2);

  // Sword
  sgui_sword.Draw(16, 8 + 64, 0);
  sgui_sword.Draw(54 + h_max_sword * 20, 8 + 64, 2);
  for X := 1 to h_max_sword do
    sgui_sword.Draw(34 + X * 20, 8 + 64, 1);
  for X := 1 to h_sword do
    sgui_sword_e.Draw(38 + X * 20, 8 + 64, 1);

  // Exp
  sgui_exp.Draw(WinW div 2 - 16, -2, 2);
  X1 := (WinW - 22 * h_max_exp) div 2;
  sgui_exp.Draw(X1 - 12, -2, 0);
  for X := 0 to h_max_exp - 1 do
  begin
    sgui_exp.Draw(X1 + X * 22, -2, 1);
    sgui_exp_e.Draw(X1 + X * 22, -2, 0);
  end;
  sgui_exp.Draw(X1 + h_max_exp * 22, -2, 3);
  for X := 0 to h_exp - 1 do
    sgui_exp_e.Draw(X1 + X * 22, -2, 1);
  sgui_exp_e.Draw(WinW div 2 - 11, 32, -2);

  //--------------------
  if show_e then
  begin
  // E Live
  X1 := WinW - 36;
  sgui_live.Draw(X1 - e_max_live * 24, 8, 0);
  sgui_live.Draw(X1 + 12, 8, 2);
  X1 := WinW - 24;
  for X := 1 to e_max_live do
  begin
    sgui_live.Draw(X1 - X * 24, 8, 1);
    sgui_live_e.Draw(X1 - X * 24, 8, 0);
  end;
  for X := 1 to e_live do
    sgui_live_e.Draw(X1 - X * 24, 8, 1);

  // E Heart
  Y := 8 + 32;
  X1 := WinW - 36 - e_max_heart * 26 - 12;
  sgui_heart.Draw(X1+12, Y, 0);
  sgui_heart.Draw(WinW - 36, Y, 2);

  for X := 1 to e_max_heart do
  begin
    sgui_heart.Draw(X1 + X * 26, Y, 1);
    sgui_heart_e.Draw(X1 + X * 26, Y, 1);
  end;
  for X := 1 to e_heart do
    sgui_heart_e.Draw(X1 + X * 26, Y, 0);

  // E Sword
  Y := 8 + 64;
  X1 := WinW - 44 - 10;
  sgui_sword_en.Draw(X1 - e_sword * 20 - 20, Y, 2);

  for X := 1 to e_sword do
    sgui_sword_en.Draw(X1 - X * 20, Y, 1);

  sgui_sword_en.Draw(X1 - 4, Y, 0);

  for X := 1 to e_sword do
    sgui_sword_e.Draw(X1 - X * 20, Y, 1);
  //
  end;
end;

end.

