class_line2d.rst 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. Member Functions
  13. ----------------
  14. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_point<class_Line2D_add_point>` **(** :ref:`Vector2<class_vector2>` position **)** |
  16. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`get_point_count<class_Line2D_get_point_count>` **(** **)** const |
  18. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Vector2<class_vector2>` | :ref:`get_point_position<class_Line2D_get_point_position>` **(** :ref:`int<class_int>` i **)** const |
  20. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`remove_point<class_Line2D_remove_point>` **(** :ref:`int<class_int>` i **)** |
  22. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_point_position<class_Line2D_set_point_position>` **(** :ref:`int<class_int>` i, :ref:`Vector2<class_vector2>` position **)** |
  24. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  25. Member Variables
  26. ----------------
  27. .. _class_Line2D_begin_cap_mode:
  28. - :ref:`LineCapMode<enum_line2d_linecapmode>` **begin_cap_mode** - Controls the style of the line's first point. Use ``LINE_CAP_*`` constants. Default value: ``LINE_CAP_NONE``.
  29. .. _class_Line2D_default_color:
  30. - :ref:`Color<class_color>` **default_color** - The line's color. Will not be used if a gradient is set.
  31. .. _class_Line2D_end_cap_mode:
  32. - :ref:`LineCapMode<enum_line2d_linecapmode>` **end_cap_mode** - Controls the style of the line's last point. Use ``LINE_CAP_*`` constants. Default value: ``LINE_CAP_NONE``.
  33. .. _class_Line2D_gradient:
  34. - :ref:`Gradient<class_gradient>` **gradient** - The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
  35. .. _class_Line2D_joint_mode:
  36. - :ref:`LineJointMode<enum_line2d_linejointmode>` **joint_mode** - The style for the points between the start and the end.
  37. .. _class_Line2D_points:
  38. - :ref:`PoolVector2Array<class_poolvector2array>` **points** - The points that form the lines. The line is drawn between every point set in this array.
  39. .. _class_Line2D_round_precision:
  40. - :ref:`int<class_int>` **round_precision** - The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
  41. .. _class_Line2D_sharp_limit:
  42. - :ref:`float<class_float>` **sharp_limit** - The direction difference in radians between vector points. This value is only used if ``joint mode`` is set to ``LINE_JOINT_SHARP``.
  43. .. _class_Line2D_texture:
  44. - :ref:`Texture<class_texture>` **texture** - The texture used for the line's texture. Uses ``texture_mode`` for drawing style.
  45. .. _class_Line2D_texture_mode:
  46. - :ref:`LineTextureMode<enum_line2d_linetexturemode>` **texture_mode** - The style to render the ``texture`` on the line. Use ``LINE_TEXTURE_*`` constants. Default value: ``LINE_TEXTURE_NONE``.
  47. .. _class_Line2D_width:
  48. - :ref:`float<class_float>` **width** - The line's width.
  49. Enums
  50. -----
  51. .. _enum_Line2D_LineCapMode:
  52. enum **LineCapMode**
  53. - **LINE_CAP_NONE** = **0** --- Don't have a line cap.
  54. - **LINE_CAP_BOX** = **1** --- Draws the line cap as a box.
  55. - **LINE_CAP_ROUND** = **2** --- Draws the line cap as a circle.
  56. .. _enum_Line2D_LineTextureMode:
  57. enum **LineTextureMode**
  58. - **LINE_TEXTURE_NONE** = **0** --- Takes the left pixels of the texture and renders it over the whole line.
  59. - **LINE_TEXTURE_TILE** = **1** --- Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
  60. .. _enum_Line2D_LineJointMode:
  61. enum **LineJointMode**
  62. - **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.
  63. - **LINE_JOINT_BEVEL** = **1** --- The line's joints will be bevelled/chamfered.
  64. - **LINE_JOINT_ROUND** = **2** --- The line's joints will be rounded.
  65. Description
  66. -----------
  67. A line through several points in 2D space.
  68. Member Function Description
  69. ---------------------------
  70. .. _class_Line2D_add_point:
  71. - void **add_point** **(** :ref:`Vector2<class_vector2>` position **)**
  72. Add a point at the ``position``. Appends the point at the end of the line.
  73. .. _class_Line2D_get_point_count:
  74. - :ref:`int<class_int>` **get_point_count** **(** **)** const
  75. Returns the Line2D's amount of points.
  76. .. _class_Line2D_get_point_position:
  77. - :ref:`Vector2<class_vector2>` **get_point_position** **(** :ref:`int<class_int>` i **)** const
  78. Returns point ``i``'s position.
  79. .. _class_Line2D_remove_point:
  80. - void **remove_point** **(** :ref:`int<class_int>` i **)**
  81. Remove the point at index ``i`` from the line.
  82. .. _class_Line2D_set_point_position:
  83. - void **set_point_position** **(** :ref:`int<class_int>` i, :ref:`Vector2<class_vector2>` position **)**
  84. Overwrites the position in point ``i`` with the supplied ``position``.