Line2D

A 2D line.

A line through several points in 2D space. Note: 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 ProjectSettings.rendering/limits/buffers/canvasPolygonBufferSizeKb and ProjectSettings.rendering/limits/buffers/canvasPolygonIndexBufferSizeKb.

@GodotBaseClass
struct Line2D {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Constants
enum Constants
LineCapMode
enum LineCapMode
LineJointMode
enum LineJointMode
LineTextureMode
enum LineTextureMode

Functions

_curveChanged
void _curveChanged()
_gradientChanged
void _gradientChanged()
addPoint
void addPoint(Vector2 position, long at_position)

Adds a point at the position. Appends the point at the end of the line. If at_position is given, the point is inserted before the point number at_position, moving that point (and every point after) after the inserted point. If at_position is not given, or is an illegal value (at_position < 0 or at_position >= $(D getPointCount)), the point will be appended at the end of the point list.

clearPoints
void clearPoints()

Removes all points from the line.

getAntialiased
bool getAntialiased()
getBeginCapMode
Line2D.LineCapMode getBeginCapMode()
getCurve
Ref!Curve getCurve()
getDefaultColor
Color getDefaultColor()
getEndCapMode
Line2D.LineCapMode getEndCapMode()
getGradient
Ref!Gradient getGradient()
getJointMode
Line2D.LineJointMode getJointMode()
getPointCount
long getPointCount()

Returns the Line2D's amount of points.

getPointPosition
Vector2 getPointPosition(long i)

Returns point i's position.

getPoints
PoolVector2Array getPoints()
getRoundPrecision
long getRoundPrecision()
getSharpLimit
double getSharpLimit()
getTexture
Ref!Texture getTexture()
getTextureMode
Line2D.LineTextureMode getTextureMode()
getWidth
double getWidth()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Line2D other)
opEquals
bool opEquals(typeof(null) n)
removePoint
void removePoint(long i)

Removes the point at index i from the line.

setAntialiased
void setAntialiased(bool antialiased)
setBeginCapMode
void setBeginCapMode(long mode)
setCurve
void setCurve(Curve curve)
setDefaultColor
void setDefaultColor(Color color)
setEndCapMode
void setEndCapMode(long mode)
setGradient
void setGradient(Gradient color)
setJointMode
void setJointMode(long mode)
setPointPosition
void setPointPosition(long i, Vector2 position)

Overwrites the position in point i with the supplied position.

setPoints
void setPoints(PoolVector2Array points)
setRoundPrecision
void setRoundPrecision(long precision)
setSharpLimit
void setSharpLimit(double limit)
setTexture
void setTexture(Texture texture)
setTextureMode
void setTextureMode(long mode)
setWidth
void setWidth(double width)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

antialiased
bool antialiased [@property getter]
bool antialiased [@property setter]

If true, the line's border will be anti-aliased.

beginCapMode
Line2D.LineCapMode beginCapMode [@property getter]
long beginCapMode [@property setter]

Controls the style of the line's first point. Use linecapmode constants.

defaultColor
Color defaultColor [@property getter]
Color defaultColor [@property setter]

The line's color. Will not be used if a gradient is set.

endCapMode
Line2D.LineCapMode endCapMode [@property getter]
long endCapMode [@property setter]

Controls the style of the line's last point. Use linecapmode constants.

gradient
Gradient gradient [@property getter]
Gradient gradient [@property setter]

The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.

jointMode
Line2D.LineJointMode jointMode [@property getter]
long jointMode [@property setter]

The style for the points between the start and the end.

points
PoolVector2Array points [@property getter]
PoolVector2Array points [@property setter]

The points that form the lines. The line is drawn between every point set in this array. Points are interpreted as local vectors.

roundPrecision
long roundPrecision [@property getter]
long roundPrecision [@property setter]

The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.

sharpLimit
double sharpLimit [@property getter]
double sharpLimit [@property setter]

The direction difference in radians between vector points. This value is only used if joint mode is set to constant LINE_JOINT_SHARP.

texture
Texture texture [@property getter]
Texture texture [@property setter]

The texture used for the line's texture. Uses texture_mode for drawing style.

textureMode
Line2D.LineTextureMode textureMode [@property getter]
long textureMode [@property setter]

The style to render the texture on the line. Use linetexturemode constants.

width
double width [@property getter]
double width [@property setter]

The line's width.

widthCurve
Curve widthCurve [@property getter]
Curve widthCurve [@property setter]

The line's width varies with the curve. The original width is simply multiply by the value of the Curve.

Static functions

_new
Line2D _new()

Construct a new instance of Line2D. Note: use memnew!Line2D instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta