The draw function you are probably using is the one declared in the TImageSprite.
procedure TImageSprite.DoDraw;
var
ImageIndex: Integer;
r: TRect;
begin
ImageIndex := GetDrawImageIndex;
r := GetDrawRect;
Image.Draw(FEngine.Surface, r.Left, r.Top, ImageIndex);
end;
I would suggest creating a new sprite class that inherits from TImageSprite that OverRides the DoDraw to implement the stretch draw function.
I think its something like: (Note I havn't tried it)
Type
TMyPlayerSprite = Class(TImageSprite)
Procedure DoDraw; Override;
End;
procedure TImageSprite.DoDraw;
var
ImageIndex: Integer;
r: TRect;
begin
ImageIndex := GetDrawImageIndex;
r := GetDrawRect;
Image.StretchDraw(FEngine.Surface, Rect(r.Left, r.Top,R.Width,R.Height), ImageIndex);
end;
PS. One of the biggest limitations of DelphiX is the use of Draw for all images. I would like to see an alternative drawing system implemented that would allow AlphaDraw, StretchDraw to be used based on a property.
Bookmarks