When I use a Line2D node to create a line, I can set the line caps to be rounded.
An example:
# enum LineCapMode:
# LINE_CAP_NONE = 0 --- Don't draw a line cap.
# LINE_CAP_BOX = 1 --- Draws the line cap as a box.
# LINE_CAP_ROUND = 2 --- Draws the line cap as a circle.
line = Line2D.new()
line.set_begin_cap_mode( 2 )
line.set_end_cap_mode( 2 )
[...]
This works, because Line2D is an object and I can change its properties.
How does this work inside the _draw() method regarding the draw_xxx() methods?
In general - How can I reference a drawn object - or is it a node? - or somethinge else?
For instance I would like to do this:
func _draw():
polyline = draw_polyline_colors( points, colors, width, true )
polyline.set_begin_cap_mode( 2 )
polyline.set_end_cap_mode( 2 )
[...]
The problem is, that draw_polyline_colors() does not have a return value, so I cannot get the node.
How can I get the reference to the drawn polyline?