class_line2d.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Line2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Line2D:
  5. Line2D
  6. ======
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A 2D line.
  12. Properties
  13. ----------
  14. +-----------------------------------------------------+------------------------------------------------------+
  15. | :ref:`LineCapMode<enum_Line2D_LineCapMode>` | :ref:`begin_cap_mode<class_Line2D_begin_cap_mode>` |
  16. +-----------------------------------------------------+------------------------------------------------------+
  17. | :ref:`Color<class_Color>` | :ref:`default_color<class_Line2D_default_color>` |
  18. +-----------------------------------------------------+------------------------------------------------------+
  19. | :ref:`LineCapMode<enum_Line2D_LineCapMode>` | :ref:`end_cap_mode<class_Line2D_end_cap_mode>` |
  20. +-----------------------------------------------------+------------------------------------------------------+
  21. | :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_Line2D_gradient>` |
  22. +-----------------------------------------------------+------------------------------------------------------+
  23. | :ref:`LineJointMode<enum_Line2D_LineJointMode>` | :ref:`joint_mode<class_Line2D_joint_mode>` |
  24. +-----------------------------------------------------+------------------------------------------------------+
  25. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`points<class_Line2D_points>` |
  26. +-----------------------------------------------------+------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`round_precision<class_Line2D_round_precision>` |
  28. +-----------------------------------------------------+------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`sharp_limit<class_Line2D_sharp_limit>` |
  30. +-----------------------------------------------------+------------------------------------------------------+
  31. | :ref:`Texture<class_Texture>` | :ref:`texture<class_Line2D_texture>` |
  32. +-----------------------------------------------------+------------------------------------------------------+
  33. | :ref:`LineTextureMode<enum_Line2D_LineTextureMode>` | :ref:`texture_mode<class_Line2D_texture_mode>` |
  34. +-----------------------------------------------------+------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`width<class_Line2D_width>` |
  36. +-----------------------------------------------------+------------------------------------------------------+
  37. Methods
  38. -------
  39. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`add_point<class_Line2D_add_point>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  41. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_point_count<class_Line2D_get_point_count>` **(** **)** const |
  43. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector2<class_Vector2>` | :ref:`get_point_position<class_Line2D_get_point_position>` **(** :ref:`int<class_int>` i **)** const |
  45. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`remove_point<class_Line2D_remove_point>` **(** :ref:`int<class_int>` i **)** |
  47. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_point_position<class_Line2D_set_point_position>` **(** :ref:`int<class_int>` i, :ref:`Vector2<class_Vector2>` position **)** |
  49. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  50. Enumerations
  51. ------------
  52. .. _enum_Line2D_LineCapMode:
  53. enum **LineCapMode**:
  54. - **LINE_CAP_NONE** = **0** --- Don't have a line cap.
  55. - **LINE_CAP_BOX** = **1** --- Draws the line cap as a box.
  56. - **LINE_CAP_ROUND** = **2** --- Draws the line cap as a circle.
  57. .. _enum_Line2D_LineTextureMode:
  58. enum **LineTextureMode**:
  59. - **LINE_TEXTURE_NONE** = **0** --- Takes the left pixels of the texture and renders it over the whole line.
  60. - **LINE_TEXTURE_TILE** = **1** --- Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
  61. - **LINE_TEXTURE_STRETCH** = **2** --- Stretches the texture across the line. Import the texture with Repeat Disabled for best results.
  62. .. _enum_Line2D_LineJointMode:
  63. enum **LineJointMode**:
  64. - **LINE_JOINT_SHARP** = **0** --- The line's joints will be pointy. If ``sharp_limit`` is greater than the rotation of a joint, it becomes a bevel joint instead.
  65. - **LINE_JOINT_BEVEL** = **1** --- The line's joints will be bevelled/chamfered.
  66. - **LINE_JOINT_ROUND** = **2** --- The line's joints will be rounded.
  67. Description
  68. -----------
  69. A line through several points in 2D space.
  70. Property Descriptions
  71. ---------------------
  72. .. _class_Line2D_begin_cap_mode:
  73. - :ref:`LineCapMode<enum_Line2D_LineCapMode>` **begin_cap_mode**
  74. +----------+---------------------------+
  75. | *Setter* | set_begin_cap_mode(value) |
  76. +----------+---------------------------+
  77. | *Getter* | get_begin_cap_mode() |
  78. +----------+---------------------------+
  79. Controls the style of the line's first point. Use ``LINE_CAP_*`` constants. Default value: ``LINE_CAP_NONE``.
  80. .. _class_Line2D_default_color:
  81. - :ref:`Color<class_Color>` **default_color**
  82. +----------+--------------------------+
  83. | *Setter* | set_default_color(value) |
  84. +----------+--------------------------+
  85. | *Getter* | get_default_color() |
  86. +----------+--------------------------+
  87. The line's color. Will not be used if a gradient is set.
  88. .. _class_Line2D_end_cap_mode:
  89. - :ref:`LineCapMode<enum_Line2D_LineCapMode>` **end_cap_mode**
  90. +----------+-------------------------+
  91. | *Setter* | set_end_cap_mode(value) |
  92. +----------+-------------------------+
  93. | *Getter* | get_end_cap_mode() |
  94. +----------+-------------------------+
  95. Controls the style of the line's last point. Use ``LINE_CAP_*`` constants. Default value: ``LINE_CAP_NONE``.
  96. .. _class_Line2D_gradient:
  97. - :ref:`Gradient<class_Gradient>` **gradient**
  98. +----------+---------------------+
  99. | *Setter* | set_gradient(value) |
  100. +----------+---------------------+
  101. | *Getter* | get_gradient() |
  102. +----------+---------------------+
  103. The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
  104. .. _class_Line2D_joint_mode:
  105. - :ref:`LineJointMode<enum_Line2D_LineJointMode>` **joint_mode**
  106. +----------+-----------------------+
  107. | *Setter* | set_joint_mode(value) |
  108. +----------+-----------------------+
  109. | *Getter* | get_joint_mode() |
  110. +----------+-----------------------+
  111. The style for the points between the start and the end.
  112. .. _class_Line2D_points:
  113. - :ref:`PoolVector2Array<class_PoolVector2Array>` **points**
  114. +----------+-------------------+
  115. | *Setter* | set_points(value) |
  116. +----------+-------------------+
  117. | *Getter* | get_points() |
  118. +----------+-------------------+
  119. The points that form the lines. The line is drawn between every point set in this array.
  120. .. _class_Line2D_round_precision:
  121. - :ref:`int<class_int>` **round_precision**
  122. +----------+----------------------------+
  123. | *Setter* | set_round_precision(value) |
  124. +----------+----------------------------+
  125. | *Getter* | get_round_precision() |
  126. +----------+----------------------------+
  127. The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
  128. .. _class_Line2D_sharp_limit:
  129. - :ref:`float<class_float>` **sharp_limit**
  130. +----------+------------------------+
  131. | *Setter* | set_sharp_limit(value) |
  132. +----------+------------------------+
  133. | *Getter* | get_sharp_limit() |
  134. +----------+------------------------+
  135. The direction difference in radians between vector points. This value is only used if ``joint mode`` is set to ``LINE_JOINT_SHARP``.
  136. .. _class_Line2D_texture:
  137. - :ref:`Texture<class_Texture>` **texture**
  138. +----------+--------------------+
  139. | *Setter* | set_texture(value) |
  140. +----------+--------------------+
  141. | *Getter* | get_texture() |
  142. +----------+--------------------+
  143. The texture used for the line's texture. Uses ``texture_mode`` for drawing style.
  144. .. _class_Line2D_texture_mode:
  145. - :ref:`LineTextureMode<enum_Line2D_LineTextureMode>` **texture_mode**
  146. +----------+-------------------------+
  147. | *Setter* | set_texture_mode(value) |
  148. +----------+-------------------------+
  149. | *Getter* | get_texture_mode() |
  150. +----------+-------------------------+
  151. The style to render the ``texture`` on the line. Use ``LINE_TEXTURE_*`` constants. Default value: ``LINE_TEXTURE_NONE``.
  152. .. _class_Line2D_width:
  153. - :ref:`float<class_float>` **width**
  154. +----------+------------------+
  155. | *Setter* | set_width(value) |
  156. +----------+------------------+
  157. | *Getter* | get_width() |
  158. +----------+------------------+
  159. The line's width.
  160. Method Descriptions
  161. -------------------
  162. .. _class_Line2D_add_point:
  163. - void **add_point** **(** :ref:`Vector2<class_Vector2>` position **)**
  164. Add a point at the ``position``. Appends the point at the end of the line.
  165. .. _class_Line2D_get_point_count:
  166. - :ref:`int<class_int>` **get_point_count** **(** **)** const
  167. Returns the Line2D's amount of points.
  168. .. _class_Line2D_get_point_position:
  169. - :ref:`Vector2<class_Vector2>` **get_point_position** **(** :ref:`int<class_int>` i **)** const
  170. Returns point ``i``'s position.
  171. .. _class_Line2D_remove_point:
  172. - void **remove_point** **(** :ref:`int<class_int>` i **)**
  173. Remove the point at index ``i`` from the line.
  174. .. _class_Line2D_set_point_position:
  175. - void **set_point_position** **(** :ref:`int<class_int>` i, :ref:`Vector2<class_Vector2>` position **)**
  176. Overwrites the position in point ``i`` with the supplied ``position``.