program Test;
//{$APPTYPE CONSOLE}

uses
  windows, zglHeader, uScene, uGlobal, uGMP, ugmpobject, uGMPL, ugmph, uGMPBul,
  uGMPLib, uGMPM, ugmppart, UGMPLE, umm, uLevels, uLevelMenu, GSound, ugmpao,
  uherogui;


procedure Init;
begin
  LoadTextures;
  GSound.InitGS;
  SceneManager := tSceneMng.Create;
  SceneManager.WinW:= WinW;
  SceneManager.WinH:= WinH;

  GMP := TGMP.Create(SceneManager);

  GMP.SetParam(0);
  //GMP.SetAsScene;

  MainMenu := TMainMenu.Create(SceneManager);

  MainMenu.SetAsScene;

  LevelMenu := TLevelMenu.Create(WinW div 2, WinH div 2 - 250, 255, MainMenu);
  //Editor.SetAsScene;


end;

procedure Draw;
begin
  SceneManager.Draw;
end;

procedure Exit;
begin

end;

procedure Update;
begin
  SceneManager.Update;
  key_ClearState();
  mouse_ClearState();
end;



{$R *.res}

begin
  Randomize;

  if not zglLoad( libZenGL ) then exit;

  zgl_Reg( SYS_LOAD, @Init);
  zgl_Reg( SYS_DRAW, @Draw);
  zgl_Reg( SYS_EXIT, @Exit);

  timer_Add( @Update, 15);

  scr_SetOptions( WinW, WinH, REFRESH_MAXIMUM, False, True);
  wnd_ShowCursor( True );

  wnd_SetCaption( 'cdmlex minimal TDS 2017' );
  zgl_Init;
end.
