API:SPoint
From STNE Wiki
Scripting Portal | Contents | API Reference | Index |
---|
The SPoint structure represents a Coordinate in a 2-dimensional-grid.
It is defined with a X-Coordinate and a Y-Coordinate, both as Integers.
Example:
Var point As New SPoint(5,5);
It has also a few Functions and Properties.
Function | Parameter | Description | Return |
---|---|---|---|
FromString | String | Creates a new SPoint from a String Value, e.g. "155|155" | Returns a SPoint on success |
op_Equality | SPoint,SPoint | Tests if the Paramaters are identic | If the Test passes, it returns True (Boolean), otherwise False |
op_Inequality | SPoint,SPoint | Inversion of op_Equality, tests on differencesf | If there are differences, Return True (Boolean), otherwise False |
RectangleDiff | SPoint | Calculates the distance to the given Point by adding the X and Y Difference. | Returns the Distance as an Integer |
Property | Description | Return Value |
---|---|---|
X | The X-Coordinate of the SPoint | Returns the X-Coordinate as Integer |
Y | The Y-Coordinate of the SPoint | Returns the Y-Coordinate as Integer |
Code Example:
Var pos1 As New SPoint(208,221); Var pos2 As New SPoint(199,222); Var pos3 As New SPoint(250,666); If(pos1.op_Inequality(pos2,pos3)) { WriteLine(pos2.X); WriteLine("Inequal Points"); If(pos1.op_Equality(pos2,pos2)) { WriteLine("pos2 is Equal to pos2"); } } WriteLine(pos3.Y);
Output:
199 Inequal Points pos2 is Equal to pos2 666