Frement
2010-12-06 18:32:32
So, I searched for some time and I didn't find a function that would allow debugging with different colors, so I made one.
Usage is simple:
And this is how it would look with 3 colors:
function DebugTPAs(TPAs: Array of TPointArray; Colors: TIntegerArray): Boolean;
var BMP, I: Integer;
Box: TBox;
BoxTPA: TPointArray;
TempTPA: TPointArray;
begin
if (High(TPAs) <> High(Colors)) then begin
Result := False;
Exit;
end;
for I := 0 to High(TPAs) do begin
AppendTPA(BoxTPA, TPAs[I]);
end;
Box := GetTPABounds(BoxTPA);
BMP := BitmapFromClient(Box.X1, Box.Y1, Box.X2, Box.Y2);
for I := 0 to High(TPAs) do begin
TempTPA := CopyTPA(TPAs[I]);
OffsetTPA(TempTPA, Point(-Box.X1, -Box.Y1));
DrawTPABitmap(BMP, TempTPA, Colors[I]);
end;
DisplayDebugImgWindow(Box.X2 - Box.X1 + 1, Box.Y2 - Box.Y1 + 1);
DrawBitmapDebugImg(BMP);
FreeBitmap(BMP);
Result := True;
end;Usage is simple:
DebugTPAs([GetNPCs, GetWhite, GetWater], [14680313, 65280, 15245824]);And this is how it would look with 3 colors: