Vector2i.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Vector2i" version="4.0">
  3. <brief_description>
  4. Vector used for 2D math using integer coordinates.
  5. </brief_description>
  6. <description>
  7. 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
  8. It uses integer coordinates and is therefore preferable to [Vector2] when exact precision is required.
  9. [b]Note:[/b] In a boolean context, a Vector2i will evaluate to [code]false[/code] if it's equal to [code]Vector2i(0, 0)[/code]. Otherwise, a Vector2i will always evaluate to [code]true[/code].
  10. </description>
  11. <tutorials>
  12. <link title="Math documentation index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
  13. <link title="Vector math">https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html</link>
  14. <link title="3Blue1Brown Essence of Linear Algebra">https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab</link>
  15. </tutorials>
  16. <constructors>
  17. <constructor name="Vector2i">
  18. <return type="Vector2i" />
  19. <description>
  20. Constructs a default-initialized [Vector2i] with all components set to [code]0[/code].
  21. </description>
  22. </constructor>
  23. <constructor name="Vector2i">
  24. <return type="Vector2i" />
  25. <argument index="0" name="from" type="Vector2i" />
  26. <description>
  27. Constructs a [Vector2i] as a copy of the given [Vector2i].
  28. </description>
  29. </constructor>
  30. <constructor name="Vector2i">
  31. <return type="Vector2i" />
  32. <argument index="0" name="from" type="Vector2" />
  33. <description>
  34. Constructs a new [Vector2i] from [Vector2]. The floating point coordinates will be truncated.
  35. </description>
  36. </constructor>
  37. <constructor name="Vector2i">
  38. <return type="Vector2i" />
  39. <argument index="0" name="x" type="int" />
  40. <argument index="1" name="y" type="int" />
  41. <description>
  42. Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code].
  43. </description>
  44. </constructor>
  45. </constructors>
  46. <methods>
  47. <method name="abs" qualifiers="const">
  48. <return type="Vector2i" />
  49. <description>
  50. Returns a new vector with all components in absolute values (i.e. positive).
  51. </description>
  52. </method>
  53. <method name="aspect" qualifiers="const">
  54. <return type="float" />
  55. <description>
  56. Returns the ratio of [member x] to [member y].
  57. </description>
  58. </method>
  59. <method name="clamp" qualifiers="const">
  60. <return type="Vector2i" />
  61. <argument index="0" name="min" type="Vector2i" />
  62. <argument index="1" name="max" type="Vector2i" />
  63. <description>
  64. Returns a new vector with all components clamped between the components of [code]min[/code] and [code]max[/code], by running [method @GlobalScope.clamp] on each component.
  65. </description>
  66. </method>
  67. <method name="sign" qualifiers="const">
  68. <return type="Vector2i" />
  69. <description>
  70. Returns the vector with each component set to one or negative one, depending on the signs of the components.
  71. </description>
  72. </method>
  73. </methods>
  74. <members>
  75. <member name="x" type="int" setter="" getter="" default="0">
  76. The vector's X component. Also accessible by using the index position [code][0][/code].
  77. </member>
  78. <member name="y" type="int" setter="" getter="" default="0">
  79. The vector's Y component. Also accessible by using the index position [code][1][/code].
  80. </member>
  81. </members>
  82. <constants>
  83. <constant name="AXIS_X" value="0">
  84. Enumerated value for the X axis.
  85. </constant>
  86. <constant name="AXIS_Y" value="1">
  87. Enumerated value for the Y axis.
  88. </constant>
  89. <constant name="ZERO" value="Vector2i(0, 0)">
  90. Zero vector, a vector with all components set to [code]0[/code].
  91. </constant>
  92. <constant name="ONE" value="Vector2i(1, 1)">
  93. One vector, a vector with all components set to [code]1[/code].
  94. </constant>
  95. <constant name="LEFT" value="Vector2i(-1, 0)">
  96. Left unit vector. Represents the direction of left.
  97. </constant>
  98. <constant name="RIGHT" value="Vector2i(1, 0)">
  99. Right unit vector. Represents the direction of right.
  100. </constant>
  101. <constant name="UP" value="Vector2i(0, -1)">
  102. Up unit vector. Y is down in 2D, so this vector points -Y.
  103. </constant>
  104. <constant name="DOWN" value="Vector2i(0, 1)">
  105. Down unit vector. Y is down in 2D, so this vector points +Y.
  106. </constant>
  107. </constants>
  108. <operators>
  109. <operator name="operator !=">
  110. <return type="bool" />
  111. <description>
  112. </description>
  113. </operator>
  114. <operator name="operator !=">
  115. <return type="bool" />
  116. <argument index="0" name="right" type="Vector2i" />
  117. <description>
  118. </description>
  119. </operator>
  120. <operator name="operator %">
  121. <return type="Vector2i" />
  122. <argument index="0" name="right" type="Vector2i" />
  123. <description>
  124. </description>
  125. </operator>
  126. <operator name="operator %">
  127. <return type="Vector2i" />
  128. <argument index="0" name="right" type="int" />
  129. <description>
  130. </description>
  131. </operator>
  132. <operator name="operator *">
  133. <return type="Vector2i" />
  134. <argument index="0" name="right" type="Vector2i" />
  135. <description>
  136. </description>
  137. </operator>
  138. <operator name="operator *">
  139. <return type="Vector2i" />
  140. <argument index="0" name="right" type="float" />
  141. <description>
  142. </description>
  143. </operator>
  144. <operator name="operator *">
  145. <return type="Vector2i" />
  146. <argument index="0" name="right" type="int" />
  147. <description>
  148. </description>
  149. </operator>
  150. <operator name="operator +">
  151. <return type="Vector2i" />
  152. <argument index="0" name="right" type="Vector2i" />
  153. <description>
  154. </description>
  155. </operator>
  156. <operator name="operator -">
  157. <return type="Vector2i" />
  158. <argument index="0" name="right" type="Vector2i" />
  159. <description>
  160. </description>
  161. </operator>
  162. <operator name="operator /">
  163. <return type="Vector2i" />
  164. <argument index="0" name="right" type="Vector2i" />
  165. <description>
  166. </description>
  167. </operator>
  168. <operator name="operator /">
  169. <return type="Vector2i" />
  170. <argument index="0" name="right" type="float" />
  171. <description>
  172. </description>
  173. </operator>
  174. <operator name="operator /">
  175. <return type="Vector2i" />
  176. <argument index="0" name="right" type="int" />
  177. <description>
  178. </description>
  179. </operator>
  180. <operator name="operator &lt;">
  181. <return type="bool" />
  182. <argument index="0" name="right" type="Vector2i" />
  183. <description>
  184. </description>
  185. </operator>
  186. <operator name="operator &lt;=">
  187. <return type="bool" />
  188. <argument index="0" name="right" type="Vector2i" />
  189. <description>
  190. </description>
  191. </operator>
  192. <operator name="operator ==">
  193. <return type="bool" />
  194. <description>
  195. </description>
  196. </operator>
  197. <operator name="operator ==">
  198. <return type="bool" />
  199. <argument index="0" name="right" type="Vector2i" />
  200. <description>
  201. </description>
  202. </operator>
  203. <operator name="operator &gt;">
  204. <return type="bool" />
  205. <argument index="0" name="right" type="Vector2i" />
  206. <description>
  207. </description>
  208. </operator>
  209. <operator name="operator &gt;=">
  210. <return type="bool" />
  211. <argument index="0" name="right" type="Vector2i" />
  212. <description>
  213. </description>
  214. </operator>
  215. <operator name="operator []">
  216. <return type="int" />
  217. <argument index="0" name="index" type="int" />
  218. <description>
  219. </description>
  220. </operator>
  221. <operator name="operator unary+">
  222. <return type="Vector2i" />
  223. <description>
  224. </description>
  225. </operator>
  226. <operator name="operator unary-">
  227. <return type="Vector2i" />
  228. <description>
  229. </description>
  230. </operator>
  231. </operators>
  232. </class>