TDirection = (dirUp, dirDown, dirLeft, dirRight);
TParticle = class
private
FColor : TColor;
FSize : Double;
FVisible : boolean;
FXpos : Integer;
FYpos : Integer;
FSpeed : Integer;
FRectangle : TRect;
public
constructor Create; virtual;
procedure Draw;
procedure Wander(const Direction: TDirection);
function MouseInParticle(const MouseX: Integer; const MouseY: Integer) : Boolean;
published
property Color: TColor read FColor write FColor;
property Size: Double read FSize write FSize;
property Visible: Boolean read FVisible write FVisible;
property XPos: Integer read FXPos write FXPos;
property YPos: Integer read FYPos write FYPos;
property Speed: Integer read FSpeed write FSpeed;
property Rectangle: TRect read FRectangle write FRectangle;
end;
function TParticle.MouseInParticle(const MouseX: Integer; const MouseY: Integer) : Boolean;
begin
Result := PtInRect(Rectangle, Point(MouseX, MouseY));
end;