unit UMain;

interface

uses
  JEN_Header,
  JEN_Math,
  Squall,
  UGame;

const Screen_Width = 1024;
      Screen_Height = 768;

var
  Engine   : IJenEngine;
  Display  : IDisplay;
  Render   : IRender;
  Render2d : IRender2d;
  Utils    : IUtils;
  Game     : TGame;
  Input    : IInput;
  ResMan   : IResourceManager;

  procedure Start;

implementation

procedure Start;
begin
  if(SQUALL_Init(0) < 0) then
  begin
    SQUALL_Free();
    Exit;
  end;

  GetJenEngine(Engine);
  Engine.GetSubSystem(ssDisplay,  IJenSubSystem(Display));
  Engine.GetSubSystem(ssUtils,    IJenSubSystem(Utils));
  Engine.GetSubSystem(ssRender,   IJenSubSystem(Render));
  Engine.GetSubSystem(ssInput,    IJenSubSystem(Input));
  Engine.GetSubSystem(ssRender2d, IJenSubSystem(Render2d));
  Engine.GetSubSystem(ssResMan,   IJenSubSystem(ResMan));
  Display.Init(Screen_width, Screen_Height,9,False);
  Render.Init();
  Render.SetVSync(False);

  Game := TGame.Create();
  Engine.Start(Game);
  Game.Free;
  Engine := nil;

  SQUALL_Free();
end;

end.
