program Game;

uses
  zglHeader,
  uMain in 'uMain.pas',
  uVar in 'uVar.pas',
  uAdd in 'uAdd.pas',
  uTeam in 'uTeam.pas',
  uEnemy in 'uEnemy.pas',
  LightEngine2D in 'LightEngine2D.pas',
  uSmplPart in 'uSmplPart.pas',
  uBlood in 'uBlood.pas';

procedure Init;
begin
  GameInit;
end;

procedure Draw;
begin
    batch2d_Begin;
      scissor_Begin(0, 0, 800, 600);
        GameDraw;
      scissor_end;
    batch2d_end;
     // text_Draw( GuiFont1, 5, 5, 'FPS: '  + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
end;

procedure Timer;
begin
  GameUpd;

  key_ClearState();
  mouse_ClearState();
  wnd_SetCaption( 'FPS :' + u_IntToStr( zgl_Get( RENDER_FPS ) )  );
end;

procedure DeInit;
begin
  GameFree;
end;

Begin
  randomize;
  {$IFNDEF STATIC}
  zglLoad( libZenGL );
  {$ENDIF}
  Randomize;
  timer_Add( @Timer, 20 );

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

  wnd_SetCaption( 'IGDC # 72' );

  wnd_ShowCursor( TRUE );

  scr_SetOptions( 800 , 600, REFRESH_MAXIMUM, false, FALSE );

  zgl_Init();
End.

