Changes

→‎Data structures: add Point and Vector2
Line 291: Line 291:  
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">
 
item.modData[$"{this.ModManifest.UniqueID}/item-age"] = "30";
 
item.modData[$"{this.ModManifest.UniqueID}/item-age"] = "30";
 +
</syntaxhighlight>
 +
 +
===Point===
 +
A point represents an integer coordinate or size, usually measured in pixels or tiles. This is formatted as an object with an X/Y position. For example:
 +
<syntaxhighlight lang="js">
 +
"Position": {
 +
    "X": 0,
 +
    "Y": 0
 +
}
 +
</syntaxhighlight>
 +
 +
===Rectangle===
 +
A rectangle represents a square area, usually measured in pixels or tiles. This is formatted as an object with an X/Y position (for the top-left corner) and width/height size, where all values are integers. For example:
 +
<syntaxhighlight lang="js">
 +
"Rectangle": {
 +
    "X": 0,
 +
    "Y": 0,
 +
    "Width": 16,
 +
    "Height": 32
 +
}
 +
</syntaxhighlight>
 +
 +
===Vector2===
 +
A Vector2 represents a non-integer coordinate or size, usually measured in pixels or tiles. This is formatted as an object with an X/Y position. For example:
 +
<syntaxhighlight lang="js">
 +
"Position": {
 +
    "X": 10.5,
 +
    "Y": 12.0
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
    
[[Category:Modding]]
 
[[Category:Modding]]
translators
8,403

edits