So I wanna create an OptionButton with items and item icons as coloured circle,
But without using an image of a circle.
So I try to write a class derived from CanvasItem and named it MyCanvas:
extends CanvasItem
var color = Color.antiquewhite
func _ready():
update()
func _init():
_draw()
func _draw():
draw_circle( Vector2(0,0), 50, color)
And then load this class in the project:
extends Panel
onready var opt = $OptionButton
var my_canvas = load("res://res/MyNodes/MyCanvas.gd")
func _ready():
var circle = my_canvas.new()
opt.add_icon_item(circle,"",0)
But item icon isn't showing anything.
Thanks for reading and helping.