unit u_SceneM;

interface

const
  tg_intro = 1;
  tg_menu  = 2;
  tg_game  = 5;
  tg_quit  = 0;
  tg_MapED = 7;

type
  TMain = class
  constructor Create;
   private
    NewScene,
    Shag,
    Color,
    BlackAlpha  : Integer;
    GameLoad,
    SceneChange : Boolean;

   public
    Scene : Integer;
    procedure SetScene(ID : Integer; GameLoad_ : Boolean = False; inShag : Integer = 10; inColor : Integer = 0);
    function  MSWork : Boolean;
    procedure Draw;
  end;

var
  StartScene : Integer;
  Main : TMain;

implementation
uses
  uGame, zglHeader, uConst, uMaterials;

constructor TMain.Create;
begin
  Scene := StartScene;
end;

procedure TMain.SetScene;
begin
  NewScene    := ID;
  BlackAlpha  := 15;
  Color       := inColor;
  Shag        := inShag;
  SceneChange := True;
  GameLoad := GameLoad_;
end;

function TMain.MSWork;
begin
  if SceneChange then
  begin
    Inc(BlackAlpha, Shag);
    if BlackAlpha <= 10 then
      SceneChange := False
    else
    if BlackAlpha >= 255 then
    begin
      Scene := NewScene;
      BlackAlpha := 250;
      Shag  := -Shag;
      case Scene of
        tg_game : if GameLoad then uGame.Load;
      end;
    end;
  end;
  Result := not SceneChange;
end;

procedure TMain.Draw;
begin
  if SceneChange then
    Pr2D_Rect(0, 0, WinW, WinH, Color, BlackAlpha, PR2D_FILL);
end;





end.
