extends Control const Brand := preload("res://scripts/ui/medmind_style.gd") var ring_value := 0.0 var track_color := Color("26324a") var fill_color := Color("2563eb") var ring_width := 8.0 var value_label: Label var caption_label: Label func _init() -> void: custom_minimum_size = Vector2(112, 112) var center := CenterContainer.new() center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) center.mouse_filter = Control.MOUSE_FILTER_IGNORE add_child(center) var stack := VBoxContainer.new() stack.add_theme_constant_override("separation", 0) center.add_child(stack) value_label = Label.new() value_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER value_label.add_theme_font_size_override("font_size", 24) stack.add_child(value_label) caption_label = Label.new() caption_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER caption_label.add_theme_font_size_override("font_size", 12) stack.add_child(caption_label) func configure(fill_fraction: float, value_text: String, caption_text: String, accent: Color, dark: bool) -> void: ring_value = clampf(fill_fraction, 0.0, 1.0) track_color = Color("26324a") if dark else Color("e2e8f0") fill_color = accent value_label.text = value_text value_label.add_theme_color_override("font_color", Brand.text_color(dark)) caption_label.text = caption_text caption_label.add_theme_color_override("font_color", Brand.muted_color(dark)) queue_redraw() func _draw() -> void: var radius := minf(size.x, size.y) / 2.0 - ring_width / 2.0 if radius <= 0.0: return var center := size / 2.0 draw_arc(center, radius, 0.0, TAU, 64, track_color, ring_width, true) if ring_value > 0.0: draw_arc(center, radius, -PI / 2.0, -PI / 2.0 + TAU * ring_value, 64, fill_color, ring_width, true)