program Images01;

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

uses SysUtils,

     fwLogging,
     fwCustomEngine,
     fwPlattform;

const
  SCREEN_WIDTH     = 320;
  SCREEN_HEIGHT    = 240;
  SCREEN_BPP       = 16;

var
  Screen           : TfwCESurface;
  Splash           : TfwCESurface;
begin
  // Welche Grafik - Engine soll verwendet werden
  fwLog('starting');
  SetHAL(TfwEngine.Create(false, false));
  try
    Screen := HAL().Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
    if Assigned(Screen) then begin
      // Lade die Grafiken
      Splash := HAL().CreateSurface('../Media/splash.bmp');

      while (not HAL().ExitKeyPressed()) do begin
        // Zeichne das Bild
        Splash.Blit(Screen, 0, 0);

        // Zeige das Screen - Buffer an
        HAL().Flip(Screen);

        // Verwaltung fuer Ereignisse aufrufen
        HAL().Idle();
        HAL().UpdateInput();
        HAL().Sleep(10);
      end;
    end;
  except
    on E : Exception do begin
      fwLog(E.Message);
    end;
  end;
  fwLog('closing');
end.
