program Game;

{==========================================================================
    IGDC.RU № 90 "RPG"
    by the Exile
    mail : theExile015@gmail.com
    icq  : 369504380
    Корвов, 2013 г.
===========================================================================}

uses
  Windows,
  zglHeader,
  uVar in 'uVar.pas',
  uMain in 'uMain.pas',
  uSmoke in 'uSmoke.pas',
  uSmplPart in 'uSmplPart.pas',
  uAdd in 'uAdd.pas';

procedure Init;
begin
  //snd_Init();
  GameInit;
end;

procedure Draw;
begin
    batch2d_Begin;
      scissor_Begin(0, 0, 800, 600);
        GameRender;
      scissor_end;
    batch2d_end;

    text_Draw( GuiFont2, 5, 5, 'FPS: '  + u_IntToStr( zgl_Get( RENDER_FPS ) ) );
end;

procedure Timer;
begin
  GameUpdate;

  key_ClearState();
  mouse_ClearState();
end;

procedure DeInit;
begin
 // GameQuit;
end;

Begin

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

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

  wnd_SetCaption( 'IGDC # 96' );

  wnd_ShowCursor( TRUE );

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

  zgl_Init();
End.

