Bobarkinator
2008-03-04 19:44:37
These functions are based off of Wizzy's DebugTPA/ATPA, except they draw on the SMART canvas instead of to the debug box. They work exactly the same also. And please tell me if it could have been done shorter as I am not an expert on canvases. F12 to clear canvas.
Function SmartDebugTPA(TPA: TPointArray): Boolean;
Var
Client,Overwrite: TCanvas;
I,Clear: Integer;
Begin
Client:= GetBitmapCanvas(BitmapFromString(765,503,''));
Client.Handle:= SmartGetDebugDC;
For I:= 0 To High(TPA) Do
Client.Pixels[TPA[I].X, TPA[I].Y]:= clRed;
SmartSetDebug(True);
Repeat
Wait(1);
Until(IsFKeyDown(12));
Clear:= BitmapFromString(765,503,'');
FastDrawClear(Clear,0);
Overwrite:= GetBitmapCanvas(Clear);
CopyCanvas(Overwrite,Client,0,0,765,503,0,0,765,503);
Result:= True;
End;
Function DebugATPA(ATPA: T2DPointArray): Boolean;
Var
Client,Overwrite: TCanvas;
I,L,Col,Clear: Integer;
Begin
Client:= GetBitmapCanvas(BitmapFromString(765,503,''));
Client.Handle:= SmartGetDebugDC;
SmartSetDebug(True);
For I:= 0 To High(ATPA) Do
Begin
Col:= Random(16777215);
For L:= 0 To High(ATPA[I]) Do
Client.Pixels[ATPA[I][L].X, ATPA[I][L].Y]:= Col;
End;
Repeat
Wait(1);
Until(IsFKeyDown(12));
Clear:= BitmapFromString(765,503,'');
FastDrawClear(Clear,0);
Overwrite:= GetBitmapCanvas(Clear);
CopyCanvas(Overwrite,Client,0,0,765,503,0,0,765,503);
Result:= True;
End;