Line2D.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Line2D" inherits="Node2D" version="3.2">
  3. <brief_description>
  4. A 2D line.
  5. </brief_description>
  6. <description>
  7. A line through several points in 2D space.
  8. [b]Note:[/b] By default, Godot can only draw up to 4,096 polygon points at a time. To increase this limit, open the Project Settings and increase [member ProjectSettings.rendering/limits/buffers/canvas_polygon_buffer_size_kb] and [member ProjectSettings.rendering/limits/buffers/canvas_polygon_index_buffer_size_kb].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_point">
  14. <return type="void">
  15. </return>
  16. <argument index="0" name="position" type="Vector2">
  17. </argument>
  18. <argument index="1" name="at_position" type="int" default="-1">
  19. </argument>
  20. <description>
  21. Adds a point at the [code]position[/code]. Appends the point at the end of the line.
  22. If [code]at_position[/code] is given, the point is inserted before the point number [code]at_position[/code], moving that point (and every point after) after the inserted point. If [code]at_position[/code] is not given, or is an illegal value ([code]at_position &lt; 0[/code] or [code]at_position &gt;= [method get_point_count][/code]), the point will be appended at the end of the point list.
  23. </description>
  24. </method>
  25. <method name="clear_points">
  26. <return type="void">
  27. </return>
  28. <description>
  29. Removes all points from the line.
  30. </description>
  31. </method>
  32. <method name="get_point_count" qualifiers="const">
  33. <return type="int">
  34. </return>
  35. <description>
  36. Returns the Line2D's amount of points.
  37. </description>
  38. </method>
  39. <method name="get_point_position" qualifiers="const">
  40. <return type="Vector2">
  41. </return>
  42. <argument index="0" name="i" type="int">
  43. </argument>
  44. <description>
  45. Returns point [code]i[/code]'s position.
  46. </description>
  47. </method>
  48. <method name="remove_point">
  49. <return type="void">
  50. </return>
  51. <argument index="0" name="i" type="int">
  52. </argument>
  53. <description>
  54. Removes the point at index [code]i[/code] from the line.
  55. </description>
  56. </method>
  57. <method name="set_point_position">
  58. <return type="void">
  59. </return>
  60. <argument index="0" name="i" type="int">
  61. </argument>
  62. <argument index="1" name="position" type="Vector2">
  63. </argument>
  64. <description>
  65. Overwrites the position in point [code]i[/code] with the supplied [code]position[/code].
  66. </description>
  67. </method>
  68. </methods>
  69. <members>
  70. <member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased" default="false">
  71. If [code]true[/code], the line's border will be anti-aliased.
  72. </member>
  73. <member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="Line2D.LineCapMode" default="0">
  74. Controls the style of the line's first point. Use [enum LineCapMode] constants.
  75. </member>
  76. <member name="default_color" type="Color" setter="set_default_color" getter="get_default_color" default="Color( 0.4, 0.5, 1, 1 )">
  77. The line's color. Will not be used if a gradient is set.
  78. </member>
  79. <member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="Line2D.LineCapMode" default="0">
  80. Controls the style of the line's last point. Use [enum LineCapMode] constants.
  81. </member>
  82. <member name="gradient" type="Gradient" setter="set_gradient" getter="get_gradient">
  83. The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
  84. </member>
  85. <member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="Line2D.LineJointMode" default="0">
  86. The style for the points between the start and the end.
  87. </member>
  88. <member name="points" type="PoolVector2Array" setter="set_points" getter="get_points" default="PoolVector2Array( )">
  89. The points that form the lines. The line is drawn between every point set in this array.
  90. </member>
  91. <member name="round_precision" type="int" setter="set_round_precision" getter="get_round_precision" default="8">
  92. The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
  93. </member>
  94. <member name="sharp_limit" type="float" setter="set_sharp_limit" getter="get_sharp_limit" default="2.0">
  95. The direction difference in radians between vector points. This value is only used if [code]joint mode[/code] is set to [constant LINE_JOINT_SHARP].
  96. </member>
  97. <member name="texture" type="Texture" setter="set_texture" getter="get_texture">
  98. The texture used for the line's texture. Uses [code]texture_mode[/code] for drawing style.
  99. </member>
  100. <member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="Line2D.LineTextureMode" default="0">
  101. The style to render the [code]texture[/code] on the line. Use [enum LineTextureMode] constants.
  102. </member>
  103. <member name="width" type="float" setter="set_width" getter="get_width" default="10.0">
  104. The line's width.
  105. </member>
  106. <member name="width_curve" type="Curve" setter="set_curve" getter="get_curve">
  107. The line's width varies with the curve. The original width is simply multiply by the value of the Curve.
  108. </member>
  109. </members>
  110. <constants>
  111. <constant name="LINE_JOINT_SHARP" value="0" enum="LineJointMode">
  112. The line's joints will be pointy. If [code]sharp_limit[/code] is greater than the rotation of a joint, it becomes a bevel joint instead.
  113. </constant>
  114. <constant name="LINE_JOINT_BEVEL" value="1" enum="LineJointMode">
  115. The line's joints will be bevelled/chamfered.
  116. </constant>
  117. <constant name="LINE_JOINT_ROUND" value="2" enum="LineJointMode">
  118. The line's joints will be rounded.
  119. </constant>
  120. <constant name="LINE_CAP_NONE" value="0" enum="LineCapMode">
  121. Don't draw a line cap.
  122. </constant>
  123. <constant name="LINE_CAP_BOX" value="1" enum="LineCapMode">
  124. Draws the line cap as a box.
  125. </constant>
  126. <constant name="LINE_CAP_ROUND" value="2" enum="LineCapMode">
  127. Draws the line cap as a circle.
  128. </constant>
  129. <constant name="LINE_TEXTURE_NONE" value="0" enum="LineTextureMode">
  130. Takes the left pixels of the texture and renders it over the whole line.
  131. </constant>
  132. <constant name="LINE_TEXTURE_TILE" value="1" enum="LineTextureMode">
  133. Tiles the texture over the line. The texture must be imported with [b]Repeat[/b] enabled for it to work properly.
  134. </constant>
  135. <constant name="LINE_TEXTURE_STRETCH" value="2" enum="LineTextureMode">
  136. Stretches the texture across the line. Import the texture with [b]Repeat[/b] disabled for best results.
  137. </constant>
  138. </constants>
  139. </class>