unit u_Menu;

interface
uses
  Omega;

type
  Check = record
  tex_ch_on, tex_ch, tex_draw, tex_nch, tex_nch_on: PTexture;
  check: Boolean;
  circle: OECircle;
  end;
  Button = Record
  Rect: OERect;
  Alpha: integer;
  end;
  Ball = record
  tex: PTexture;
  x, y, speed: integer;
  end;

var
  font: pfont2d;
  splash: PTexture;
  new_game, quit: button;
  procedure Menu_Process;
  procedure Menu_Paint;

implementation
uses
  u_Game, u_Init;

procedure Menu_Process;
var i, j: integer;
begin
  if Col_PointInAABB( Mouse_X, Mouse_Y, @new_game.rect )
  then new_game.Alpha := 255 else new_game.Alpha := 180;
  if Col_PointInAABB( Mouse_X, Mouse_Y, @quit.rect )
  then quit.Alpha := 255 else quit.Alpha := 180;
  if Mouse_Press ( M_LBUTTON ) then
  begin
    if Col_PointInAABB( Mouse_X, Mouse_Y, @new_game.rect ) then
    begin
      Scene := sGame;
      player.X := 600;
      player.Y := 500;
    end;
    if Col_PointInAABB( Mouse_X, Mouse_Y, @quit.rect ) then OE_Quit;
  end;
end;

procedure Menu_Paint;
var
i, j: integer;
begin
  SSprite_Draw( splash, 0, 0, 640, 512, 255, 0, FX_DEFAULT );
  Text_Draw( font, 10, 400, 'New game', 1, 0, new_game.alpha);
  Text_Draw( font, 10, 425, 'Quit game', 1, 0, quit.alpha);
  SSprite_Draw( cur, Mouse_X - 16, Mouse_Y - 16, 32, 32, 255, 0, 1 );
  //pr2d_rect(new_game.Rect.X, new_game.Rect.Y, new_game.Rect.Width, new_game.Rect.Height, $FEDECE, 255, 0);
end;

end.

