unit unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AdDraws, AdClasses, ADparticles;
type
TForm1 =
class(TForm)
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
public
AdDraw1:TAdDraw;
AdImageList1:TPictureCollection;
partsys:TAdParticleSystem;
AdPerCounter:TPerformanceCounter;
procedure Idle(Sender:TObject;
var Done:boolean);
{ Public-Deklarationen }
end;
var
Form1: TForm1;
xpos,ypos:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
AdDraw1 := TAdDraw.Create(self);
AdDraw1.DllName := '
AndorraDX93D.dll';
if AdDraw1.Initialize
then
begin
AdPerCounter := TPerformanceCounter.Create;
Application.OnIdle := Idle;
AdImageList1 := TPictureCollection.Create(AdDraw1);
with AdImageList1.Add('
sprite')
do
begin
Texture.LoadGraphicFromFile('
sprite.bmp',true,clFuchsia);
end;
AdImageList1.Restore;
partsys := TAdParticleSystem.Create(AdDraw1);
partsys.Texture := AdImageList1.Items[0].Texture;
partsys.DefaultParticle.LifeTime:=0.3;
end
else
begin
ShowMessage('
Error while initializing Andorra 2D. Try to use another display'+
'
mode or another video adapter.');
halt;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
AdImageList1.Free;
AdPerCounter.Free;
AdDraw1.Free;
end;
procedure TForm1.Idle(Sender: TObject;
var Done: boolean);
var
i:integer;
begin
if AdDraw1.CanDraw
then
begin
AdPerCounter.Calculate;
Caption := '
FPS:'+inttostr(AdPerCounter.FPS);
AdDraw1.ClearSurface(clblack);
AdDraw1.BeginScene;
partsys.CreateParticles(2,TAdParticle,xpos,ypos);
PartSys.Move(AdPerCounter.TimeGap / 2000);
partsys.Draw(0, 0);
AdDraw1.EndScene;
AdDraw1.Flip;
end;
Done := false;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
xpos:=x-form1.left;
ypos:=y-form1.top;
end;
end.