2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "Line2D" inherits= "Node2D" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
A 2D line.
</brief_description>
<description >
A line through several points in 2D space.
</description>
<tutorials >
2020-10-01 16:34:47 +08:00
<link title= "Matrix Transform Demo" > https://godotengine.org/asset-library/asset/584</link>
<link title= "2.5D Demo" > https://godotengine.org/asset-library/asset/583</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<methods >
<method name= "add_point" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "position" type= "Vector2" />
<argument index= "1" name= "at_position" type= "int" default= "-1" />
2017-09-13 04:42:36 +08:00
<description >
2019-06-22 07:04:47 +08:00
Adds a point at the [code]position[/code]. Appends the point at the end of the line.
2019-04-08 17:14:10 +08:00
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 < 0[/code] or [code]at_position > = [method get_point_count][/code]), the point will be appended at the end of the point list.
2017-09-13 04:42:36 +08:00
</description>
</method>
2019-03-20 00:59:24 +08:00
<method name= "clear_points" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2019-03-20 00:59:24 +08:00
<description >
Removes all points from the line.
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_point_count" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-02 06:12:14 +08:00
Returns the Line2D's amount of points.
2017-09-13 04:42:36 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "get_point_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Vector2" />
<argument index= "0" name= "i" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-11-18 08:29:32 +08:00
Returns point [code]i[/code]'s position.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "remove_point" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "i" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2019-06-22 07:04:47 +08:00
Removes the point at index [code]i[/code] from the line.
2017-09-13 04:42:36 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "set_point_position" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
<argument index= "0" name= "i" type= "int" />
<argument index= "1" name= "position" type= "Vector2" />
2017-09-13 04:42:36 +08:00
<description >
2018-02-22 00:30:55 +08:00
Overwrites the position in point [code]i[/code] with the supplied [code]position[/code].
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-11-24 18:00:02 +08:00
<member name= "antialiased" type= "bool" setter= "set_antialiased" getter= "get_antialiased" default= "false" >
If [code]true[/code], the line's border will be anti-aliased.
2021-08-18 02:05:38 +08:00
[b]Note:[/b] Line2D is not accelerated by batching when being anti-aliased.
2019-11-24 18:00:02 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "begin_cap_mode" type= "int" setter= "set_begin_cap_mode" getter= "get_begin_cap_mode" enum= "Line2D.LineCapMode" default= "0" >
2019-12-07 06:09:20 +08:00
Controls the style of the line's first point. Use [enum LineCapMode] constants.
2017-09-13 04:42:36 +08:00
</member>
2019-09-25 01:45:03 +08:00
<member name= "default_color" type= "Color" setter= "set_default_color" getter= "get_default_color" default= "Color(1, 1, 1, 1)" >
2017-10-02 06:12:14 +08:00
The line's color. Will not be used if a gradient is set.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "end_cap_mode" type= "int" setter= "set_end_cap_mode" getter= "get_end_cap_mode" enum= "Line2D.LineCapMode" default= "0" >
2019-12-07 06:09:20 +08:00
Controls the style of the line's last point. Use [enum LineCapMode] constants.
2017-09-13 04:42:36 +08:00
</member>
2019-07-16 02:42:47 +08:00
<member name= "gradient" type= "Gradient" setter= "set_gradient" getter= "get_gradient" >
2017-10-02 06:12:14 +08:00
The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "joint_mode" type= "int" setter= "set_joint_mode" getter= "get_joint_mode" enum= "Line2D.LineJointMode" default= "0" >
2018-01-19 04:37:17 +08:00
The style for the points between the start and the end.
2017-09-13 04:42:36 +08:00
</member>
2019-09-25 01:45:03 +08:00
<member name= "points" type= "PackedVector2Array" setter= "set_points" getter= "get_points" default= "PackedVector2Array()" >
2020-08-21 01:54:58 +08:00
The points that form the lines. The line is drawn between every point set in this array. Points are interpreted as local vectors.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "round_precision" type= "int" setter= "set_round_precision" getter= "get_round_precision" default= "8" >
2017-10-02 06:12:14 +08:00
The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "sharp_limit" type= "float" setter= "set_sharp_limit" getter= "get_sharp_limit" default= "2.0" >
2021-12-02 16:15:13 +08:00
The direction difference in radians between vector points. This value is only used if [member joint_mode] is set to [constant LINE_JOINT_SHARP].
2017-09-13 04:42:36 +08:00
</member>
2020-02-12 16:59:06 +08:00
<member name= "texture" type= "Texture2D" setter= "set_texture" getter= "get_texture" >
2017-10-02 06:12:14 +08:00
The texture used for the line's texture. Uses [code]texture_mode[/code] for drawing style.
2017-09-13 04:42:36 +08:00
</member>
2019-06-30 03:45:14 +08:00
<member name= "texture_mode" type= "int" setter= "set_texture_mode" getter= "get_texture_mode" enum= "Line2D.LineTextureMode" default= "0" >
2019-12-07 06:09:20 +08:00
The style to render the [code]texture[/code] on the line. Use [enum LineTextureMode] constants.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "width" type= "float" setter= "set_width" getter= "get_width" default= "10.0" >
2017-10-02 06:12:14 +08:00
The line's width.
2017-09-13 04:42:36 +08:00
</member>
2019-07-16 02:42:47 +08:00
<member name= "width_curve" type= "Curve" setter= "set_curve" getter= "get_curve" >
2019-05-01 12:50:01 +08:00
The line's width varies with the curve. The original width is simply multiply by the value of the Curve.
</member>
2017-09-13 04:42:36 +08:00
</members>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "LINE_JOINT_SHARP" value= "0" enum= "LineJointMode" >
2017-10-02 06:12:14 +08:00
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.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_JOINT_BEVEL" value= "1" enum= "LineJointMode" >
2017-10-02 06:12:14 +08:00
The line's joints will be bevelled/chamfered.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_JOINT_ROUND" value= "2" enum= "LineJointMode" >
2017-10-02 06:12:14 +08:00
The line's joints will be rounded.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_CAP_NONE" value= "0" enum= "LineCapMode" >
2019-06-22 07:04:47 +08:00
Don't draw a line cap.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_CAP_BOX" value= "1" enum= "LineCapMode" >
2017-10-02 06:12:14 +08:00
Draws the line cap as a box.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_CAP_ROUND" value= "2" enum= "LineCapMode" >
2017-10-02 06:12:14 +08:00
Draws the line cap as a circle.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_TEXTURE_NONE" value= "0" enum= "LineTextureMode" >
2017-10-02 06:12:14 +08:00
Takes the left pixels of the texture and renders it over the whole line.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "LINE_TEXTURE_TILE" value= "1" enum= "LineTextureMode" >
2019-06-22 07:04:47 +08:00
Tiles the texture over the line. The texture must be imported with [b]Repeat[/b] enabled for it to work properly.
2017-09-13 04:42:36 +08:00
</constant>
2018-07-16 20:31:19 +08:00
<constant name= "LINE_TEXTURE_STRETCH" value= "2" enum= "LineTextureMode" >
2019-06-22 07:04:47 +08:00
Stretches the texture across the line. Import the texture with [b]Repeat[/b] disabled for best results.
2018-07-16 20:31:19 +08:00
</constant>
2017-09-13 04:42:36 +08:00
</constants>
</class>