unit uMain;
interface
uses
Windows, Dialogs, SysUtils, Graphics, Classes, Forms, AdDraws, AdClasses,
Controls, ExtCtrls, AdSprites, AdSetupDlg, AdPNG, AdPerformanceCounter,
AdGUI,AdComponents;
type
TForm1=
class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
AdDraw:TAdDraw;
AdPerCounter:TAdPerformanceCounter;
AdImageList1:TAdImageList;
AdSpriteEngine:TSpriteEngine;
procedure Idle(Sender:TObject;
var Done:boolean);
{ Public-Deklarationen }
end;
var
Form1: TForm1;
AdGUI : TAdGUI;
const
path = '
./resources/';
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
AdSetupDlg:TAdSetup;
begin
AdPerCounter := TAdPerformanceCounter.Create;
AdDraw := TAdDraw.Create(self);
AdSetupDlg := TAdSetup.Create(AdDraw);
AdSetupDlg.Image := '
logo1.png';
if AdSetupDlg.Execute
then
begin
if AdDraw.Initialize
then
begin
Application.OnIdle := Idle;
AdImageList1 := TAdImageList.Create(AdDraw);
AdImageList1.Restore;
AdGUI := TAdGUI.Create(AdDraw);
//Erzeugen der Klasse
AdGUI.Skin.LoadFromFile('
sunna.axs');
//Laden des Skins
AdGUI.Cursors.LoadFromFile('
cursors.xml');
//Laden der Cursor
AdGUI.LoadFromFile('
Gui.axg');
//Laden der GUI
AdSpriteEngine := TSpriteEngine.Create(
nil);
AdSpriteEngine.Surface := AdDraw;
Randomize;
end
else
begin
ShowMessage(AdDraw.GetLastError);
halt;
end;
end
else
begin
halt;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
AdSpriteEngine.Free;
AdImageList1.Free;
AdPerCounter.Free;
AdDraw.Free;
end;
procedure TForm1.Idle(Sender: TObject;
var Done: boolean);
begin
if AdDraw.CanDraw
then
begin
AdPerCounter.Calculate;
Caption := '
FPS:'+inttostr(AdPerCounter.FPS);
AdDraw.ClearSurface(clBlack);
AdDraw.BeginScene;
AdSpriteEngine.Move(AdPerCounter.TimeGap / 1000);
AdSpriteEngine.Draw;
AdSpriteEngine.Dead;
AdDraw.EndScene;
AdDraw.Flip;
Done := false;
end;
end;
end.