API:SPoint
From STNE Wiki
(Difference between revisions)
(Added Functions) |
(Added Properties and Code Example) |
||
(One intermediate revision not shown) | |||
Line 18: | Line 18: | ||
|FromString | |FromString | ||
|String | |String | ||
- | |Creates a new SPoint from a String Value, e.g. "155|155" | + | |Creates a new SPoint from a String Value, e.g. "155<nowiki>|</nowiki>155" |
|Returns a SPoint on success | |Returns a SPoint on success | ||
|- | |- | ||
Line 36: | Line 36: | ||
|Returns the Distance as an Integer | |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 | ||
+ | |||
[[Category:API]] | [[Category:API]] |
Latest revision as of 20:10, 25 January 2021
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