Documentation
¶
Overview ¶
This node draws a 2D polyline, i.e. a shape consisting of several points connected by segments. graphics.gd/classdb/Line2D is not a mathematical polyline, i.e. the segments are not infinitely thin. It is intended for rendering and it can be colored and optionally textured.
Warning: Certain configurations may be impossible to draw nicely, such as very sharp angles. In these situations, the node uses fallback drawing logic to look decent.
Note: graphics.gd/classdb/Line2D is drawn using a 2D mesh.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddPoint(position Vector2.XY)
- func (self Instance) Antialiased() bool
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsLine2D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) BeginCapMode() LineCapMode
- func (self Instance) ClearPoints()
- func (self Instance) Closed() bool
- func (self Instance) DefaultColor() Color.RGBA
- func (self Instance) EndCapMode() LineCapMode
- func (self Instance) GetPointCount() int
- func (self Instance) GetPointPosition(index int) Vector2.XY
- func (self Instance) Gradient() Gradient.Instance
- func (self Instance) ID() ID
- func (self Instance) JointMode() LineJointMode
- func (self Instance) Points() []Vector2.XY
- func (self Instance) RemovePoint(index int)
- func (self Instance) RoundPrecision() int
- func (self Instance) SetAntialiased(value bool)
- func (self Instance) SetBeginCapMode(value LineCapMode)
- func (self Instance) SetClosed(value bool)
- func (self Instance) SetDefaultColor(value Color.RGBA)
- func (self Instance) SetEndCapMode(value LineCapMode)
- func (self Instance) SetGradient(value Gradient.Instance)
- func (self Instance) SetJointMode(value LineJointMode)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPointPosition(index int, position Vector2.XY)
- func (self Instance) SetPoints(value []Vector2.XY)
- func (self Instance) SetRoundPrecision(value int)
- func (self Instance) SetSharpLimit(value Float.X)
- func (self Instance) SetTexture(value Texture2D.Instance)
- func (self Instance) SetTextureMode(value LineTextureMode)
- func (self Instance) SetWidth(value Float.X)
- func (self Instance) SetWidthCurve(value Curve.Instance)
- func (self Instance) SharpLimit() Float.X
- func (self Instance) Texture() Texture2D.Instance
- func (self Instance) TextureMode() LineTextureMode
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) Width() Float.X
- func (self Instance) WidthCurve() Curve.Instance
- type LineCapMode
- type LineJointMode
- type LineTextureMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
func (Expanded) AddPoint ¶
Adds a point with the specified 'position' relative to the polyline's own position. If no 'index' is provided, the new point will be added to the end of the points array.
If 'index' is given, the new point is inserted before the existing point identified by index 'index'. The indices of the points after the new point get increased by 1. The provided 'index' must not exceed the number of existing points in the polyline. See Instance.GetPointCount.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddPoint ¶
Adds a point with the specified 'position' relative to the polyline's own position. If no 'index' is provided, the new point will be added to the end of the points array.
If 'index' is given, the new point is inserted before the existing point identified by index 'index'. The indices of the points after the new point get increased by 1. The provided 'index' must not exceed the number of existing points in the polyline. See Instance.GetPointCount.
func (Instance) Antialiased ¶
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) BeginCapMode ¶
func (self Instance) BeginCapMode() LineCapMode
func (Instance) ClearPoints ¶
func (self Instance) ClearPoints()
Removes all points from the polyline, making it empty.
func (Instance) DefaultColor ¶
func (Instance) EndCapMode ¶
func (self Instance) EndCapMode() LineCapMode
func (Instance) GetPointCount ¶
Returns the number of points in the polyline.
func (Instance) GetPointPosition ¶
Returns the position of the point at index 'index'.
func (Instance) JointMode ¶
func (self Instance) JointMode() LineJointMode
func (Instance) RemovePoint ¶
Removes the point at index 'index' from the polyline.
func (Instance) RoundPrecision ¶
func (Instance) SetAntialiased ¶
func (Instance) SetBeginCapMode ¶
func (self Instance) SetBeginCapMode(value LineCapMode)
func (Instance) SetDefaultColor ¶
func (Instance) SetEndCapMode ¶
func (self Instance) SetEndCapMode(value LineCapMode)
func (Instance) SetGradient ¶
func (Instance) SetJointMode ¶
func (self Instance) SetJointMode(value LineJointMode)
func (Instance) SetPointPosition ¶
Overwrites the position of the point at the given 'index' with the supplied 'position'.
func (Instance) SetRoundPrecision ¶
func (Instance) SetSharpLimit ¶
func (Instance) SetTexture ¶
func (Instance) SetTextureMode ¶
func (self Instance) SetTextureMode(value LineTextureMode)
func (Instance) SetWidthCurve ¶
func (Instance) SharpLimit ¶
func (Instance) TextureMode ¶
func (self Instance) TextureMode() LineTextureMode
func (Instance) WidthCurve ¶
type LineCapMode ¶
type LineCapMode int //gd:Line2D.LineCapMode
const ( // Draws no line cap. LineCapNone LineCapMode = 0 // Draws the line cap as a box, slightly extending the first/last segment. LineCapBox LineCapMode = 1 // Draws the line cap as a semicircle attached to the first/last segment. LineCapRound LineCapMode = 2 )
type LineJointMode ¶
type LineJointMode int //gd:Line2D.LineJointMode
const ( // Makes the polyline's joints pointy, connecting the sides of the two segments by extending them until they intersect. If the rotation of a joint is too big (based on [Instance.SharpLimit]), the joint falls back to [LineJointBevel] to prevent very long miters. LineJointSharp LineJointMode = 0 // Makes the polyline's joints bevelled/chamfered, connecting the sides of the two segments with a simple line. LineJointBevel LineJointMode = 1 // Makes the polyline's joints rounded, connecting the sides of the two segments with an arc. The detail of this arc depends on [Instance.RoundPrecision]. LineJointRound LineJointMode = 2 )
type LineTextureMode ¶
type LineTextureMode int //gd:Line2D.LineTextureMode
const ( // Takes the left pixels of the texture and renders them over the whole polyline. LineTextureNone LineTextureMode = 0 // Tiles the texture over the polyline. [graphics.gd/classdb/CanvasItem.Instance.TextureRepeat] of the [graphics.gd/classdb/Line2D] node must be [Canvasitem.TextureRepeatEnabled] or [Canvasitem.TextureRepeatMirror] for it to work properly. LineTextureTile LineTextureMode = 1 // Stretches the texture across the polyline. [graphics.gd/classdb/CanvasItem.Instance.TextureRepeat] of the [graphics.gd/classdb/Line2D] node must be [Canvasitem.TextureRepeatDisabled] for best results. LineTextureStretch LineTextureMode = 2 )