class_name ABGUIIcon extends Control const Tokens = preload("res://foundation/ui_tokens.gd") ## Small owned vector icon used by shared command surfaces. It intentionally ## stays presentation-only so page Views can replace Unicode glyphs without ## depending on gameplay, Save or EntryShell state. var icon_kind := "generic" var icon_tone := "dark" var disabled := false var hot := false func configure(next_kind: String, next_tone := "dark") -> ABGUIIcon: icon_kind = next_kind.to_lower() if Tokens.icon_kind_supported(next_kind) else "generic" icon_tone = next_tone queue_redraw() return self func set_state(next_disabled := false, next_hot := false) -> void: disabled = next_disabled hot = next_hot queue_redraw() func _ready() -> void: mouse_filter = Control.MOUSE_FILTER_IGNORE set_process(true) queue_redraw() func _process(_delta: float) -> void: var parent_button := get_parent() as BaseButton if parent_button != null: var next_disabled := parent_button.disabled var next_hot := not next_disabled and (parent_button.is_hovered() or parent_button.has_focus()) if next_disabled != disabled or next_hot != hot: set_state(next_disabled, next_hot) func _draw() -> void: if size.x <= 1.0 or size.y <= 1.0: return var center := size * 0.5 var radius := minf(size.x, size.y) * 0.31 var scale := maxf(0.65, minf(size.x, size.y) / 24.0) var color := Tokens.icon_color(disabled, hot, icon_tone != "light") var width := maxf(1.2, 1.8 * scale) match icon_kind: "back": draw_polyline(PackedVector2Array([ center + Vector2(5.5, -6.5) * scale, center + Vector2(-3.5, 0.0) * scale, center + Vector2(5.5, 6.5) * scale, ]), color, width, true) draw_line(center + Vector2(-3.0, 0.0) * scale, center + Vector2(8.0, 0.0) * scale, color, width, true) "confirm": draw_polyline(PackedVector2Array([ center + Vector2(-7.0, 0.0) * scale, center + Vector2(-2.0, 5.0) * scale, center + Vector2(8.0, -6.0) * scale, ]), color, width, true) "settings": draw_arc(center, radius * 0.62, 0.0, TAU, 20, color, width, true) draw_circle(center, radius * 0.18, color) for angle in range(0, 360, 45): var direction := Vector2.RIGHT.rotated(deg_to_rad(float(angle))) draw_line(center + direction * radius * 0.72, center + direction * radius * 1.06, color, width, true) "inspect": draw_circle(center + Vector2(-2.5, -2.5) * scale, radius * 0.58, Color(color, 0.08)) draw_arc(center + Vector2(-2.5, -2.5) * scale, radius * 0.58, 0.0, TAU, 20, color, width, true) draw_line(center + Vector2(2.0, 2.0) * scale, center + Vector2(8.0, 8.0) * scale, color, width, true) "company": _draw_people(center, radius, color, width) "coin": var gem := PackedVector2Array([ center + Vector2(0.0, -radius * 1.15), center + Vector2(radius * 0.82, -radius * 0.22), center + Vector2(radius * 0.56, radius * 0.96), center + Vector2(-radius * 0.56, radius * 0.96), center + Vector2(-radius * 0.82, -radius * 0.22), ]) draw_colored_polygon(gem, Color(color, 0.24)) draw_polyline(gem, color, width, true) draw_line(center + Vector2(0.0, -radius * 0.92), center + Vector2(0.0, radius * 0.82), color, width * 0.72, true) "equipment": var shield := PackedVector2Array([ center + Vector2(-radius * 0.86, -radius * 0.72), center + Vector2(radius * 0.86, -radius * 0.72), center + Vector2(radius * 0.70, radius * 0.26), center + Vector2(0.0, radius * 1.02), center + Vector2(-radius * 0.70, radius * 0.26), ]) draw_colored_polygon(shield, Color(color, 0.16)) draw_polyline(shield, color, width, true) draw_line(center + Vector2(0.0, -radius * 0.60), center + Vector2(0.0, radius * 0.72), color, width * 0.72, true) "party": draw_line(center + Vector2(-radius * 0.72, -radius), center + Vector2(-radius * 0.72, radius), color, width, true) draw_colored_polygon(PackedVector2Array([ center + Vector2(-radius * 0.56, -radius * 0.82), center + Vector2(radius * 0.92, -radius * 0.50), center + Vector2(radius * 0.30, radius * 0.16), center + Vector2(-radius * 0.56, -radius * 0.10), ]), Color(color, 0.90)) "risk": var flame := PackedVector2Array([ center + Vector2(0.0, -radius * 1.12), center + Vector2(radius * 0.70, -radius * 0.10), center + Vector2(radius * 0.54, radius * 0.70), center + Vector2(0.0, radius * 1.04), center + Vector2(-radius * 0.64, radius * 0.62), center + Vector2(-radius * 0.50, -radius * 0.16), center + Vector2(-radius * 0.08, radius * 0.20), center + Vector2(0.0, -radius * 1.12), ]) draw_polyline(flame, color, width, true) "pause": draw_line(center + Vector2(-4.0, -7.0) * scale, center + Vector2(-4.0, 7.0) * scale, color, width, true) draw_line(center + Vector2(4.0, -7.0) * scale, center + Vector2(4.0, 7.0) * scale, color, width, true) "speed": draw_line(center + Vector2(-8.0, 4.0) * scale, center + Vector2(0.0, -4.0) * scale, color, width, true) draw_line(center + Vector2(0.0, -4.0) * scale, center + Vector2(8.0, 4.0) * scale, color, width, true) draw_line(center + Vector2(-8.0, 8.0) * scale, center + Vector2(0.0, 0.0) * scale, Color(color, 0.64), width * 0.8, true) "retry": draw_arc(center, radius * 0.75, -PI * 0.18, PI * 1.45, 18, color, width, true) draw_polyline(PackedVector2Array([ center + Vector2(-8.0, -4.0) * scale, center + Vector2(-8.0, 3.0) * scale, center + Vector2(-2.0, 2.0) * scale, ]), color, width, true) "close": draw_line(center + Vector2(-6.0, -6.0) * scale, center + Vector2(6.0, 6.0) * scale, color, width, true) draw_line(center + Vector2(6.0, -6.0) * scale, center + Vector2(-6.0, 6.0) * scale, color, width, true) "help": draw_arc(center, radius * 0.92, 0.0, TAU, 24, color, width, true) draw_circle(center + Vector2(0.0, 6.0) * scale, width * 0.60, color) draw_arc(center + Vector2(0.0, -2.0) * scale, radius * 0.30, PI, TAU, 12, color, width, true) "generic": draw_arc(center, radius * 0.88, 0.0, TAU, 24, color, width, true) func _draw_people(center: Vector2, radius: float, color: Color, width: float) -> void: for offset in [-0.48, 0.0, 0.48]: var head := center + Vector2(radius * offset, -radius * (0.26 if offset == 0.0 else 0.16)) var head_radius := radius * (0.23 if offset == 0.0 else 0.18) draw_arc(head, head_radius, 0.0, TAU, 14, color, width, true) var shoulder := Vector2(head.x, center.y + radius * (0.28 if offset == 0.0 else 0.34)) draw_arc(shoulder, radius * (0.36 if offset == 0.0 else 0.28), PI, TAU, 12, color, width, true)