unit uScreen;

{$mode delphi}

interface

uses
  Classes, SysUtils, uScene, uMeForm, uGame;

type

{ TScreen }

{ TScreen1 }

TScreen1 = class(tScene)
  Form : TMeForm;
  constructor Create(const PSceneMng : tSceneMng); override;
  procedure Draw; override;
  procedure Update; override;
end;

{ TScreen2 }

TScreen2 = class(tScene)
  Form : TMeForm;
  constructor Create(const PSceneMng : tSceneMng); override;
  procedure Draw; override;
  procedure Update; override;
end;

{ TButtonOk }

TButtonOk = class(TMeFormObject)

  procedure Click; override;
end;

{ TButtonExit }

TButtonExit = class(TMeFormObject)
  procedure Click; override;
end;

var
  Game : TGame;
  Screen1 : TScreen1;
  Screen2 : TScreen2;
implementation
uses
  uGlobal, zglHeader;

{ TButtonOk }

procedure TButtonOk.Click;
begin
  Game.SetAsScene;
end;

{ TButtonExit }

procedure TButtonExit.Click;
begin
  zglHeader.zgl_Exit;
end;

{ TScreen2 }

constructor TScreen2.Create(const PSceneMng: tSceneMng);
begin
    SceneMng := PSceneMng;
  Form := TMeForm.Create(0, 0, 255, Self);

  TButtonExit.Create(WinW div 2, WinH - 256, BtnClose_Shape, BtnClose_DrawRect, Form).Text:=UTF8Decode('Закрыть игру');

end;

procedure TScreen2.Draw;
begin
  scr2.DrawC(WinW div 2, WinH div 2 + 32, 0);
  Form.Draw;
end;

procedure TScreen2.Update;
begin
  Form.Update(mouse_x, mouse_y);
end;

{ TScreen }

constructor TScreen1.Create(const PSceneMng: tSceneMng);
begin
    SceneMng := PSceneMng;
  Form := TMeForm.Create(0, 0, 255, Self);

  TButtonOk.Create(WinW div 2 + 128, WinH - 80, BtnClose_Shape, BtnClose_DrawRect, Form).Text:=UTF8Decode('Начать игру');
  TButtonExit.Create(WinW div 2 - 128, WinH - 80, BtnClose_Shape, BtnClose_DrawRect, Form).Text:=UTF8Decode('Закрыть игру');

end;

procedure TScreen1.Draw;
begin
  scr1.DrawC(WinW div 2, WinH div 2, 0);
  Form.Draw;
end;

procedure TScreen1.Update;
begin
  Form.Update(mouse_x, mouse_y);
end;

end.

