class_line2d.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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:`int<class_int>` **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:`int<class_int>` **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:`int<class_int>` **joint_mode** - The style for the points inbetween 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:`int<class_int>` **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. Numeric Constants
  50. -----------------
  51. - **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.
  52. - **LINE_JOINT_BEVEL** = **1** --- The line's joints will be bevelled/chamfered.
  53. - **LINE_JOINT_ROUND** = **2** --- The line's joints will be rounded.
  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. - **LINE_TEXTURE_NONE** = **0** --- Takes the left pixels of the texture and renders it over the whole line.
  58. - **LINE_TEXTURE_TILE** = **1** --- Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
  59. Description
  60. -----------
  61. A line through several points in 2D space.
  62. Member Function Description
  63. ---------------------------
  64. .. _class_Line2D_add_point:
  65. - void **add_point** **(** :ref:`Vector2<class_vector2>` position **)**
  66. Add a point at the ``position``. Appends the point at the end of the line.
  67. .. _class_Line2D_get_point_count:
  68. - :ref:`int<class_int>` **get_point_count** **(** **)** const
  69. Returns the Line2D's amount of points.
  70. .. _class_Line2D_get_point_position:
  71. - :ref:`Vector2<class_vector2>` **get_point_position** **(** :ref:`int<class_int>` i **)** const
  72. Returns point ``i``'s position.
  73. .. _class_Line2D_remove_point:
  74. - void **remove_point** **(** :ref:`int<class_int>` i **)**
  75. Remove the point at index ``i`` from the line.
  76. .. _class_Line2D_set_point_position:
  77. - void **set_point_position** **(** :ref:`int<class_int>` i, :ref:`Vector2<class_vector2>` position **)**
  78. Overwites the position in point ``i`` with the supplied ``position``.