Refactor multi-resource UI and transfers

This commit is contained in:
Loïc Wisniewski 2026-08-14 11:54:31 +02:00
commit 8231e165ff
20 changed files with 648 additions and 435 deletions

View file

@ -27,6 +27,7 @@ enum Icon {
UPGRADE_ENGINES, UPGRADE_UNLOCK_SHIELD,
ACTION_MENU,
GAS,
LEFT_ARROW, RIGHT_ARROW,
}
# Size the glyphs were originally drawn against. Every glyph dimension is
@ -203,6 +204,10 @@ func _draw() -> void:
_draw_action_menu(center, pulse, s)
Icon.GAS:
_draw_gas(center, pulse, s)
Icon.LEFT_ARROW:
_draw_horizontal_arrow(center, pulse, -1.0, s)
Icon.RIGHT_ARROW:
_draw_horizontal_arrow(center, pulse, 1.0, s)
func _draw_close(center: Vector2, pulse: float, s: float) -> void:
@ -228,6 +233,15 @@ func _draw_arrow(center: Vector2, pulse: float, direction: float, s: float) -> v
NeonDraw.draw_glowing_line(self, tip, tip + Vector2(r * 0.7, -r * 0.8 * direction), _active_color(), pulse, 0.5 * s, core_color)
func _draw_horizontal_arrow(center: Vector2, pulse: float, direction: float, s: float) -> void:
var r: float = 10.0 * s
var tip: Vector2 = center + Vector2(r * direction, 0.0)
var tail: Vector2 = center + Vector2(-r * direction, 0.0)
NeonDraw.draw_glowing_line(self, tail, tip, _active_color(), pulse, 0.5 * s, core_color)
NeonDraw.draw_glowing_line(self, tip, tip + Vector2(-r * 0.8 * direction, -r * 0.7), _active_color(), pulse, 0.5 * s, core_color)
NeonDraw.draw_glowing_line(self, tip, tip + Vector2(-r * 0.8 * direction, r * 0.7), _active_color(), pulse, 0.5 * s, core_color)
func _draw_transfer_icon(center: Vector2, pulse: float, s: float) -> void:
# Two shafts side by side pointing opposite ways. Drawn as a pair rather
# than as one double-headed arrow because the button's whole job is that