unit TMenu;

interface

uses
  DGLEngine_header,windows,Math,SysUtils;
const
  Cm:array[1..1,1..10]of byte=((1,1,0,0,0,0,0,0,0,0));

Type

proc=procedure;
Menu = class(Tobject)
  Background:Cardinal;
  Mask:array[1..10] of byte;
  procedure DrwBackground;
  procedure LoadImg;
end;

Button = class(Menu)
  Icon:Cardinal;
  Posx,Posy,Lenx,Leny,Link:longint;
  Activity,Visibility:boolean;
  procedure DrawBtn;
  constructor Create(Px,Py,Lx,Ly,Lk:longint);
  procedure Run(x,y:longint);
end;

implementation

procedure Menu.DrwBackground;
begin
 Begin2D;
  DrawTexture2D(Background,0,0,1000,600,0,255,-1);
 End2D;
end;

procedure Button.DrawBtn;
begin
  Begin2D;
    if Activity then DrawSprite2D(Icon,Posx,Posy,Lenx,Leny,2,1,1,0,255,-1) else
    DrawSprite2D(Icon,Posx,Posy,Lenx,Leny,2,1,2,0,255,-1);
  End2D;
end;

procedure Menu.LoadImg;
begin
  Background:=LoadTextureFromFile('Data\textures\igdc.jpg');
end;

constructor Button.Create(Px,Py,Lx,Ly,Lk:longint);
begin
  Posx:=Px;
  Posy:=Py;
  Lenx:=Lx;
  Leny:=Ly;
  Link:=Lk;
  if link<3 then
  Icon:=LoadTextureFromFile('Data\Button\'+IntToStr(Link)+'.bmp',texdetail_best,transcolor_black);
  Activity:=false;
end;

procedure Button.Run(x,y:longint);
begin
  if (x>=Posx)and(x<=Posx+Lenx)and(y>=Posy)and(y<=Posy+Leny) then
  begin
    Activity:=true;
  end else Activity:=false;
end;

end.






