unit DEngExample;

//
//  Simplifications for demo programs.
//

{$MODE FPC}
{$MODESWITCH DEFAULTPARAMETERS}
{$MODESWITCH OUT}
{$MODESWITCH RESULT}

interface

uses
  DEngBase,
  DEng,
  DWinApi;

procedure ExampleRun(const Caption: AnsiString; Init, Done, Render: TCallback);

procedure ExampleUpdate(Eng: TEngine);
function ExampleOnWindowEvent(Ev: PWindowEvent): Boolean;

implementation

procedure ExampleRun(const Caption: AnsiString; Init, Done, Render: TCallback);
begin
  Eng.InitDisplayMode(800, 600, 32, DENG_GL);
  Eng.InitTitle(Caption);
  Eng.InitInitFunc(Init);
  Eng.InitDoneFunc(Done);
  Eng.InitRenderFunc(Render);
  Eng.InitUpdateFunc(@ExampleUpdate, 30);
  Eng.InitEventFunc(@ExampleOnWindowEvent);
  Eng.Run;
end;

procedure ExampleUpdate(Eng: TEngine);
begin
end;

function ExampleOnWindowEvent(Ev: PWindowEvent): Boolean;
begin
  if Ev^.IsKeyDown(KEY_ESC) then
    Eng.StopLoop;
  Exit(False);
end;

end.
