SRL Archive - Discussions and Debates

TPA Debugger??


Camaro'

2008-11-11 21:34:46

out of random i was just in school and i had just thought of this really good idea! Make a TPA Debugger that uses canvas which puts a red dot on the pixel that your tpa finds? Something among those lines. Im horrible at canvas + no time to do this but its a challenge(i think ) well off to bed..

The_Shermanator

2008-11-11 21:37:51

Already been done :)
procedure DebugATPA(aPoints: T2DPointArray); 
var
ClientBMP, I, I2: Integer;
B: TBox;

Begin
B := GetATPABounds(aPoints);
DisplayDebugImgWindow(B.x2 - B.x1, B.y2 - B.y1);
ClientBMP := BitmapFromString(B.x2 - B.x1, B.y2 - B.y1, '');
CopyClientToBitmap(ClientBMP, B.x1, B.y1, b.x2, b.y2);
for I := 0 to High(aPoints) do
begin
for I2 := 0 to High(aPoints[i]) do
FastSetPixel(ClientBMP, aPoints[i][I2].X - b.x1, aPoints[i][I2].Y - b.y1, 255);
end;
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
try
FreeBitmap(ClientBMP);
except
end;
end;

-Shermanator

lordsaturn

2008-11-11 21:38:36

http://www.villavu.com/forum/showthread.php?t=18636?t=20369&highlight=debugtpa

^_^

markuska815

2008-11-11 21:39:49

There already is one…
Idk if Cazax made it but i got it from him:
Edit: I guess he didnt Lord Saturn beat me
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
Var
Width, Height, ClientBMP, I, L: Integer;
xs, ys, xe, ye: Integer;
Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;

For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);

xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;

Width := xe - xs;
Height := ye - ys;

DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');

CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);

FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;

TViYH

2008-11-16 21:28:58

Will this put the dot on the RS Client?

Or just SMART?

markuska815

2008-11-16 21:41:09

neither it creates a new debug window and paints on that