Wrappers¶
The wrappers include contains wrapper functions used throughout SRL, some of them to simplify coding while others are just fixes.
The source for this file can be found here <https://github.com/Olly-/SRL/blob/master/lib/utilities/wrappers.simba>
_.
GetClientBounds()¶
function GetClientBounds(): TBox;
Returns the clients bounds.
Note
By Olly
Example:
b := GetClientBounds();
GetColor; overload¶
function GetColor(const p: TPoint): Integer; overload;
Takes a TPoint variable instead of x, y variables.
Note
By Olly
Example:
p := Point(350, 200);
WriteLn(GetColor(p));
GetColors; overload¶
function GetColors(const TPA: TPointArray; const ClearSame: boolean): TIntegerArray; overload;
Takes an extra parameter, clearSame if true will clear the same integers in the result.
Note
By Olly
Example:
Colors := GetColors(TPA, True);
FindColor; overload¶
function FindColor(var x, y: integer; const Color: integer; const SearchBox: TBox): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Coh3n
Example:
FindColor(x, y, clRed, Box);
findColorTolerance; overload¶
function FindColorTolerance(var x, y: Integer; const Color: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
FindColorTolerance(x, y, 255, Box, 10);
FindColors; overload¶
function FindColors(var Points: TPointArray; const Color: Integer; const SearchBox: TBox): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Coh3n
Example:
WriteLn(FindColors(TPA, 255, Box));
FindColorsTolerance; overload¶
function FindColorsTolerance(var Points: TPointArray; const Color: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Zyt3x
Example:
WriteLn(FindColorsTolerance(TPA, 255, Box, 10));
CountColor; overload¶
function CountColor(const Color: Integer; const SearchBox: TBox): Integer; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Coh3n
Example:
WriteLn(CountColor(clRed, Box));
CountColorTolerance: overload;¶
function CountColorTolerance(Color: integer; searchBox: TBox; tol: integer): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Coh3n
Example:
WriteLn(CountColorTolerance(clRed, 10, Box));
BitmapFromClient; overload¶
function BitmapFromClient(const SearchBox: TBox): Integer; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
BMP := BitmapFromClient(Box);
FindBitmapIn; overload¶
function FindBitmapIn(const BMP: Integer; var x, y: integer; const SearchBox: TBox): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
Result := FindBitmap(bmp, x, y, Box);
FindBitmapToleranceIn; overload¶
function FindBitmapToleranceIn(const BMP: Integer; var x, y: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
Result := FindBitmapToleranceIn(BMP, x, y, Box, 20);
FindDTMRotatedSE; overload¶
function FindDTMRotatedSE(const DTM: Integer; var x, y: Integer; SearchBox: TBox; sAngle, eAngle, aStep, aFound: Extended): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
if (FindDTMRotatedSE(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
WriteLn('Found the dtm!');
FindDTMRotatedAlternating: overload;¶
function FindDTMRotatedAlternating(DTM: Integer; var x, y: Integer; SearchBox: TBox; sAngle, eAngle, aStep, aFound: Extended): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
if (FindDTMRotatedAlternating(DTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
WriteLn('Found the dtm!');
FindDTMRotated¶
function FindDTMRotated(const DTM: Integer; var x, y: Integer; const x1, y1, x2, y2: Integer; const sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;
Searches for a rotated DTM, A legacy method commonly used in past SRL versions.
Note
By Olly
Example:
if (FindDTMRotated(DTM, x, y, 100, 100, 400, 400, -Pi/4, Pi/4, Pi/60, aFound)) then
WriteLn('Found the dtm!');
FindDTMRotated; overload¶
function FindDTMRotated(const DTM: Integer; var x, y: Integer; const SearchBox: TBox; const sAngle, eAngle, aStep: extended; out aFound: Extended): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
if (FindDTMRotated(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
WriteLn('found the dtm!');
FindDTMs; overload¶
function FindDTMs(const DTM: Integer; var TPA: TPointArray; const SearchBox: TBox): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
FindDTMs(DTM, TPA, Box);
WriteLn('Matches' + toString(TPA));
FindDTM; overload¶
function FindDTM(const DTM: Integer; var x, y: Integer; const SearchBox: TBox): Boolean; overload;
Takes a TBox variable instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
WriteLn(FindDTM(DTM, x, y, Box));
TPAFromText; overload¶
function TPAFromText(const Text, Font: string): TPointArray; overload;
Creates a TPA of the text without the need for the W and H params.
Note
By Olly
Example:
TPA := TPAFromText('Hello world', StatChars);
InRange; overload¶
function InRange(const Value, Min, Max: Extended): Boolean; overload;
Takes a extended variable instead of an integer variable.
Note
By Olly
Example:
WriteLn(InRange(15.0, 10.0, 20.0));
Distance; overload¶
function Distance(const p1, p2: TPoint): Integer; overload;
Accepts two TPoints instead of x1, y1, x2 and y2 variables.
Note
By Olly
Example:
WriteLn(Distance(Point(100, 100), Point(200, 200)));