Line2D
Category: Core
A 2D line.
Properties
void | ( Vector2 position ) |
void | ( ) |
int | ( ) const |
Vector2 | ( int i ) const |
void | ( int i ) |
void | ( int i, position ) |
Enumerations
enum LineJointMode:
- LINE_JOINT_SHARP = 0 — The line’s joints will be pointy. If is greater than the rotation of a joint, it becomes a bevel joint instead.
- LINE_JOINT_BEVEL = 1 — The line’s joints will be bevelled/chamfered.
- LINE_JOINT_ROUND = 2 — The line’s joints will be rounded.
enum LineCapMode:
- LINE_CAP_BOX = 1 — Draws the line cap as a box.
- LINE_CAP_ROUND = 2 — Draws the line cap as a circle.
enum LineTextureMode:
- LINE_TEXTURE_NONE = 0 — Takes the left pixels of the texture and renders it over the whole line.
- LINE_TEXTURE_TILE = 1 — Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
- LINE_TEXTURE_STRETCH = 2 — Stretches the texture across the line. Import the texture with Repeat Disabled for best results.
A line through several points in 2D space.
Property Descriptions
- LineCapMode begin_cap_mode
Setter | set_begin_cap_mode(value) |
Getter | get_begin_cap_mode() |
Controls the style of the line’s first point. Use LINE_CAP_*
constants. Default value: .
- Color default_color
Setter | set_default_color(value) |
Getter | get_default_color() |
- end_cap_mode
Controls the style of the line’s last point. Use LINE_CAP_*
constants. Default value: LINE_CAP_NONE.
- gradient
Setter | set_gradient(value) |
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.
- LineJointMode joint_mode
Setter | set_joint_mode(value) |
Getter | get_joint_mode() |
The style for the points between the start and the end.
Setter | set_points(value) |
Getter | get_points() |
The points that form the lines. The line is drawn between every point set in this array.
- round_precision
The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.
- float sharp_limit
Setter | set_sharp_limit(value) |
Getter | get_sharp_limit() |
The direction difference in radians between vector points. This value is only used if joint mode
is set to .
- Texture texture
Setter | set_texture(value) |
Getter | get_texture() |
The texture used for the line’s texture. Uses for drawing style.
- texture_mode
Setter | set_texture_mode(value) |
Getter | get_texture_mode() |
- float width
The line’s width.
- void add_point ( position )
Add a point at the position
. Appends the point at the end of the line.
- void clear_points ( )
Removes all points from the line.
- int get_point_count ( ) const
Returns the Line2D’s amount of points.
- get_point_position ( int i ) const
Returns point ’s position.
- void remove_point ( i )
Remove the point at index i
from the line.
Overwrites the position in point i
with the supplied position
.