Skip to content

Commit

Permalink
Rename TSimbaTarget to TTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Aug 5, 2023
1 parent b998460 commit 66558c5
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 180 deletions.
2 changes: 1 addition & 1 deletion DocGen/doccomments.simba
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ begin
end;

begin
Contents := FileRead('Source/script/imports/simba/simba.import_encoding.pas');
Contents := FileRead('Source/script/imports/simba/simba.import_target.pas');

for DocComment in Contents.BetweenAll('(*','*)') do
begin
Expand Down
6 changes: 3 additions & 3 deletions DocGen/docgen.simba
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ begin
MakeCodeBlock(Comments);
MakeInlineCode(Comments);

Comments := Comments.Replace('Image:', '.. figure::');
Comments := Comments.Replace('Note:', '.. note::');
Comments := Comments.Replace('Warning:', '.. warning::');
Comments := Comments.Replace('Image::', '.. figure::');
Comments := Comments.Replace('Note::', '.. note::');
Comments := Comments.Replace('Warning::', '.. warning::');

FileWrite(INPUT_DIR + Name + '.rst', Comments);
FileAppend(INPUT_DIR + 'index.rst', ' ' + Name + LINE_SEP);
Expand Down
11 changes: 8 additions & 3 deletions Source/script/imports/simba/simba.import_box.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ implementation
(*
TBox
====
The TBox type is a record which defines a box.
The `TBox` type is a record which defines a box from top left and bottom right coords.
- `X1` is the **top left** `X` coord
- `Y1` is the **top left** `Y` coord
- `X2` is the **bottom right** `X` coord
- `Y2` is the **bottom right** `Y` coord
*)

(*
Expand Down Expand Up @@ -344,7 +349,7 @@ procedure _LapeBox_RandomPoint(const Params: PParamArray; const Result: Pointer)
~~~~~~~~~~~~~~~~~~~~~~
> function TBox.RandomPointCenter: TPoint;
Returns a random point in the box which is weighted torwards the box center.
Returns a random point in the box which is weighted towards the box center.
*)
procedure _LapeBox_RandomPointCenter(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
begin
Expand Down Expand Up @@ -400,4 +405,4 @@ procedure ImportBox(Compiler: TSimbaScript_Compiler);
end;
end;

end.
end.
20 changes: 12 additions & 8 deletions Source/script/imports/simba/simba.import_debugimage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ implementation

(*
DebugImageDisplay
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
> procedure DebugImageDisplay(X, Y,Width, Height: Integer);
*)

Expand Down Expand Up @@ -196,6 +196,17 @@ procedure ImportDebugImage(Compiler: TSimbaScript_Compiler);
'end;'
]);

ImportingSection := 'Image';

addGlobalFunc(
'procedure TImage.Show(EnsureVisible: Boolean = True);', [
'begin',
' _SimbaScript.DebugImage_Show(Self, EnsureVisible);',
'end;'
]);

ImportingSection := 'Debug Image';

addGlobalFunc(
'procedure Show(Matrix: TIntegerMatrix); overload;', [
'begin',
Expand Down Expand Up @@ -364,13 +375,6 @@ procedure ImportDebugImage(Compiler: TSimbaScript_Compiler);
'end;'
]);

addGlobalFunc(
'procedure TImage.Show(EnsureVisible: Boolean = True); override;', [
'begin',
' _SimbaScript.DebugImage_Show(Self, EnsureVisible);',
'end;'
]);

ImportingSection := '';
end;
end;
Expand Down
4 changes: 2 additions & 2 deletions Source/script/imports/simba/simba.import_dialogs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ procedure ImportDialogs(Compiler: TSimbaScript_Compiler);
addGlobalFunc('function ShowComboDialog(Caption, Prompt: string; List: TStringArray): Integer', @_LapeInputCombo);
addGlobalFunc('procedure ShowMessage(Message: String)', @_LapeShowMessage);
addGlobalFunc('function ShowQuestionDialog(Title, Question: String): ESimbaDialogResult', @_LapeShowQuestionDialog);
addGlobalFunc('function ShowDTMEditor(Target: TSimbaTarget; Title: String): String', @_LapeShowDTMEditor);
addGlobalFunc('function ShowACA(Target: TSimbaTarget; Title: String): TColorTolerance', @_LapeShowACA);
addGlobalFunc('function ShowDTMEditor(Target: TTarget; Title: String): String', @_LapeShowDTMEditor);
addGlobalFunc('function ShowACA(Target: TTarget; Title: String): TColorTolerance', @_LapeShowACA);

addGlobalFunc(
'procedure ShowTrayNotification(Title, Message: String; Timeout: Integer = 3000);', [
Expand Down
6 changes: 3 additions & 3 deletions Source/script/imports/simba/simba.import_finder.pas
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ procedure ImportFinder(Compiler: TSimbaScript_Compiler);

addGlobalType([
'packed record',
' Target: TSimbaTarget;',
' Target: TTarget;',
'end;'],
'TSimbaFinder'
);
Expand Down Expand Up @@ -427,7 +427,7 @@ procedure ImportFinder(Compiler: TSimbaScript_Compiler);
addInputMethod('function TSimbaFinder.AverageBrightness(Area: TBox = [-1,-1,-1,-1]): Integer', @_LapeSimbaFinder_AverageBrightness);
addInputMethod('function TSimbaFinder.PeakBrightness(Area: TBox = [-1,-1,-1,-1]): Integer', @_LapeSimbaFinder_PeakBrightness);

ImportingSection := 'TImage';
ImportingSection := 'Image';

addGlobalFunc(
'function TImage.Finder: TSimbaFinder;', [
Expand All @@ -441,4 +441,4 @@ procedure ImportFinder(Compiler: TSimbaScript_Compiler);
end;
end;

end.
end.
6 changes: 3 additions & 3 deletions Source/script/imports/simba/simba.import_input.pas
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ procedure _LapeSimbaInput_MouseScroll(const Params: PParamArray); LAPE_WRAPPER_C
Speed, Gravity and Wind variables affects this.
Note: The algorithm used is WindMouse. For more details see <https://ben.land/post/2021/04/25/windmouse-human-mouse-movement>
Note:: The algorithm used is WindMouse. For more details see <https://ben.land/post/2021/04/25/windmouse-human-mouse-movement>
*)
procedure _LapeSimbaInput_MouseMove(const Params: PParamArray); LAPE_WRAPPER_CALLING_CONV
begin
Expand Down Expand Up @@ -400,7 +400,7 @@ procedure ImportInput(Compiler: TSimbaScript_Compiler);

addGlobalType([
'packed record',
' Target: TSimbaTarget;',
' Target: TTarget;',
'',
' MinPressTime: Integer;',
' MaxPressTime: Integer;',
Expand Down Expand Up @@ -625,4 +625,4 @@ procedure ImportInput(Compiler: TSimbaScript_Compiler);
end;
end;

end.
end.
18 changes: 17 additions & 1 deletion Source/script/imports/simba/simba.import_random.pas
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ implementation
Methods relating to generating random numbers.
*)

(*
RandSeed
~~~~~~~~~~
> var RandSeed: UInt32;
The random seed used for all random number generation.
*)

(*
RandCutoff
~~~~~~~~~~
> var RandCutoff: Double;
Cutoff for `RandomLeft`, `RandomRight`, `RandomMode`, `RandomMean`
*)

(*
RandomCenterTPA
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -173,4 +189,4 @@ procedure ImportRandom(Compiler: TSimbaScript_Compiler);
end;
end;

end.
end.
Loading

0 comments on commit 66558c5

Please sign in to comment.