File: Line2D.xml

package info (click to toggle)
godot 3.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 270,588 kB
  • sloc: cpp: 971,579; ansic: 617,953; xml: 80,302; asm: 17,498; cs: 14,559; python: 11,744; java: 9,681; javascript: 4,654; pascal: 1,176; sh: 896; objc: 529; makefile: 176
file content (132 lines) | stat: -rw-r--r-- 7,953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Line2D" inherits="Node2D" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		A 2D line.
	</brief_description>
	<description>
		A line through several points in 2D space. Supports varying width and color over the line's length, texturing, and several cap/joint types.
		[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].
	</description>
	<tutorials>
		<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>
	</tutorials>
	<methods>
		<method name="add_point">
			<return type="void" />
			<argument index="0" name="position" type="Vector2" />
			<argument index="1" name="index" type="int" default="-1" />
			<description>
				Adds a point with the specified [code]position[/code] relative to the line's own position. Appends the new point at the end of the point list.
				If [code]index[/code] is given, the new point is inserted before the existing point identified by index [code]index[/code]. Every existing point starting from [code]index[/code] is shifted further down the list of points. The index must be greater than or equal to [code]0[/code] and must not exceed the number of existing points in the line. See [method get_point_count].
			</description>
		</method>
		<method name="clear_points">
			<return type="void" />
			<description>
				Removes all points from the line.
			</description>
		</method>
		<method name="get_point_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns the amount of points in the line.
			</description>
		</method>
		<method name="get_point_position" qualifiers="const">
			<return type="Vector2" />
			<argument index="0" name="index" type="int" />
			<description>
				Returns the position of the point at index [code]index[/code].
			</description>
		</method>
		<method name="remove_point">
			<return type="void" />
			<argument index="0" name="index" type="int" />
			<description>
				Removes the point at index [code]index[/code] from the line.
			</description>
		</method>
		<method name="set_point_position">
			<return type="void" />
			<argument index="0" name="index" type="int" />
			<argument index="1" name="position" type="Vector2" />
			<description>
				Overwrites the position of the point at index [code]index[/code] with the supplied [code]position[/code].
			</description>
		</method>
	</methods>
	<members>
		<member name="antialiased" type="bool" setter="set_antialiased" getter="get_antialiased" default="false">
			If [code]true[/code], the line's border will attempt to perform antialiasing by drawing thin OpenGL smooth lines on the line's edges.
			[b]Note:[/b] Line2D is not accelerated by batching if [member antialiased] is [code]true[/code].
			[b]Note:[/b] Due to how it works, built-in antialiasing will not look correct for translucent lines and may not work on certain platforms. As a workaround, install the [url=https://github.com/godot-extended-libraries/godot-antialiased-line2d]Antialiased Line2D[/url] add-on then create an AntialiasedLine2D node. That node relies on a texture with custom mipmaps to perform antialiasing. 2D batching is also still supported with those antialiased lines.
		</member>
		<member name="begin_cap_mode" type="int" setter="set_begin_cap_mode" getter="get_begin_cap_mode" enum="Line2D.LineCapMode" default="0">
			Controls the style of the line's first point. Use [enum LineCapMode] constants.
		</member>
		<member name="default_color" type="Color" setter="set_default_color" getter="get_default_color" default="Color( 0.4, 0.5, 1, 1 )">
			The line's color. Will not be used if a gradient is set.
		</member>
		<member name="end_cap_mode" type="int" setter="set_end_cap_mode" getter="get_end_cap_mode" enum="Line2D.LineCapMode" default="0">
			Controls the style of the line's last point. Use [enum LineCapMode] constants.
		</member>
		<member name="gradient" type="Gradient" setter="set_gradient" getter="get_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.
		</member>
		<member name="joint_mode" type="int" setter="set_joint_mode" getter="get_joint_mode" enum="Line2D.LineJointMode" default="0">
			The style for the points between the start and the end.
		</member>
		<member name="points" type="PoolVector2Array" setter="set_points" getter="get_points" default="PoolVector2Array(  )">
			The points that form the lines. The line is drawn between every point set in this array. Points are interpreted as local vectors.
		</member>
		<member name="round_precision" type="int" setter="set_round_precision" getter="get_round_precision" default="8">
			The smoothness of the rounded joints and caps. Higher values result in smoother corners, but are more demanding to render and update. This is only used if a cap or joint is set as round.
			[b]Note:[/b] The default value is tuned for lines with the default [member width]. For thin lines, this value should be reduced to a number between [code]2[/code] and [code]4[/code] to improve performance.
		</member>
		<member name="sharp_limit" type="float" setter="set_sharp_limit" getter="get_sharp_limit" default="2.0">
			The direction difference in radians between vector points. This value is only used if [member joint_mode] is set to [constant LINE_JOINT_SHARP].
		</member>
		<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
			The texture used for the line's texture. Uses [code]texture_mode[/code] for drawing style.
		</member>
		<member name="texture_mode" type="int" setter="set_texture_mode" getter="get_texture_mode" enum="Line2D.LineTextureMode" default="0">
			The style to render the [code]texture[/code] on the line. Use [enum LineTextureMode] constants.
		</member>
		<member name="width" type="float" setter="set_width" getter="get_width" default="10.0">
			The line's width.
		</member>
		<member name="width_curve" type="Curve" setter="set_curve" getter="get_curve">
			The line's width varies with the curve. The original width is simply multiply by the value of the Curve.
		</member>
	</members>
	<constants>
		<constant name="LINE_JOINT_SHARP" value="0" enum="LineJointMode">
			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.
		</constant>
		<constant name="LINE_JOINT_BEVEL" value="1" enum="LineJointMode">
			The line's joints will be bevelled/chamfered.
		</constant>
		<constant name="LINE_JOINT_ROUND" value="2" enum="LineJointMode">
			The line's joints will be rounded.
		</constant>
		<constant name="LINE_CAP_NONE" value="0" enum="LineCapMode">
			Don't draw a line cap.
		</constant>
		<constant name="LINE_CAP_BOX" value="1" enum="LineCapMode">
			Draws the line cap as a box.
		</constant>
		<constant name="LINE_CAP_ROUND" value="2" enum="LineCapMode">
			Draws the line cap as a circle.
		</constant>
		<constant name="LINE_TEXTURE_NONE" value="0" enum="LineTextureMode">
			Takes the left pixels of the texture and renders it over the whole line.
		</constant>
		<constant name="LINE_TEXTURE_TILE" value="1" enum="LineTextureMode">
			Tiles the texture over the line. The texture must be imported with [b]Repeat[/b] enabled for it to work properly.
		</constant>
		<constant name="LINE_TEXTURE_STRETCH" value="2" enum="LineTextureMode">
			Stretches the texture across the line. Import the texture with [b]Repeat[/b] disabled for best results.
		</constant>
	</constants>
</class>