-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
113 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
var | ||
Arr: array of Integer; | ||
Index, Value: Integer; | ||
myArray: array of Int32; | ||
begin | ||
Arr.SetLength(3); | ||
Arr[0] := 200; | ||
Arr[1] := 400; | ||
Arr[2] := 600; | ||
|
||
WriteLn('Index of 400 is ', Arr.IndexOf(400)); | ||
myArray := [1,2,3,4,5,4,3,2,1]; | ||
WriteLn myArray; | ||
|
||
Arr := [5,6,7,8]; | ||
Arr.Append(100); | ||
// Length of array, or how many items it contains. | ||
WriteLn Length(myArray); | ||
|
||
WriteLn('For loop:'); | ||
for Index := 0 to Arr.Length() - 1 do | ||
WriteLn('Arr[', Index, '] is ', Arr[Index]); | ||
// Index of last item which is Length(myArray) - 1 | ||
WriteLn High(myArray); | ||
|
||
WriteLn('For in loop') | ||
for Value in Arr.Reversed() do | ||
WriteLn(Value); | ||
end. | ||
// access first element: | ||
WriteLn myArray[0]; | ||
|
||
// access second element: | ||
WriteLn myArray[1]; | ||
|
||
// access last item: | ||
WriteLn myArray[High(myArray)]; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var | ||
TPA: TPointArray; | ||
ATPA: T2DPointArray; | ||
I: Integer; | ||
begin | ||
// Create a random array to test on | ||
TPA := RandomTPA(100, [100,100,300,300]); | ||
TPA := TPA.Grow(3); | ||
|
||
// Cluster by 10 distance, if a point is not within 10 distance of any other | ||
// points in a group, add it to a new group. | ||
ATPA := TPA.Cluster(20); | ||
|
||
Show(ATPA); | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var | ||
Img: TImage; | ||
begin | ||
Img := TImage.Create(500, 500); // Images must explictly created and freed! | ||
Img.DrawBox([100,100,400,400], $0000FF); | ||
Img.DrawLine([50, 50], [450, 50], 5, $00FFFF); | ||
Img.SetPixel(250, 250, $FFFFFF); | ||
Img.SetFontSize(25); | ||
Img.SetFontAntialiasing(False); | ||
Img.DrawText('Hello world', [125, 125], $00FF00); | ||
|
||
WriteLn('Color at 250,250 is ', '$' + IntToHex(Img.GetPixel(250, 250))); | ||
WriteLn('Available fonts: ', Img.LoadedFontNames()); | ||
|
||
Img.Show(); // Show on Simba's debug image | ||
Img.Free(); // Images must be freed | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
var | ||
TPA: TPointArray; // stores the teleport events so we can view at the end | ||
|
||
procedure MouseTeleportEvent(var Sender: TInput; X, Y: Integer); | ||
begin | ||
WriteLn('Mouse teleported to: ', X, ', ', Y); | ||
TPA += [X, Y]; | ||
end; | ||
|
||
var | ||
Event: TMouseTeleportEvent; | ||
begin | ||
Event := Input.AddOnMouseTeleportEvent(@MouseTeleportEvent); | ||
Input.MouseTeleport([200,200]); | ||
Input.MouseMove([600,600]); | ||
Input.RemoveOnMouseTeleportEvent(Event); // Remove the event | ||
|
||
Input.MouseMove([200, 600]); // The event has been removed so this wont be "recorded" when we show the path | ||
|
||
Show(TPA); // Now we can see what actually happened | ||
end; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters