Collapse contextual building actions

This commit is contained in:
Loïc Wisniewski 2026-08-13 20:49:15 +02:00
commit d79c756d5b
4 changed files with 110 additions and 34 deletions

View file

@ -25,6 +25,7 @@ enum Icon {
UPGRADE_DAMAGE, UPGRADE_RATE, UPGRADE_RANGE, UPGRADE_THRUSTERS,
UPGRADE_SHIELD_HITS, UPGRADE_SHIELD_RECHARGE, UPGRADE_CARGO,
UPGRADE_ENGINES, UPGRADE_UNLOCK_SHIELD,
ACTION_MENU,
}
# Size the glyphs were originally drawn against. Every glyph dimension is
@ -176,6 +177,8 @@ func _draw() -> void:
_draw_upgrade_engines(center, pulse, s)
Icon.UPGRADE_UNLOCK_SHIELD:
_draw_upgrade_unlock_shield(center, pulse, s)
Icon.ACTION_MENU:
_draw_action_menu(center, pulse, s)
func _draw_close(center: Vector2, pulse: float, s: float) -> void:
@ -300,6 +303,17 @@ func _draw_upgrade_unlock_shield(center: Vector2, pulse: float, s: float) -> voi
NeonDraw.draw_glowing_line(self, center + Vector2(0, -4) * s, center + Vector2(0, 4) * s, _active_color(), pulse, 0.45 * s, core_color)
func _draw_action_menu(center: Vector2, pulse: float, s: float) -> void:
# A small, intentionally neutral stack of choices. It marks a button that
# opens context actions rather than carrying out one particular action.
for y in [-8.0, 0.0, 8.0]:
NeonDraw.draw_glowing_line(self, center + Vector2(-10, y) * s, center + Vector2(10, y) * s, _active_color(), pulse, 0.42 * s, core_color)
NeonDraw.draw_glowing_polygon(self, PackedVector2Array([
center + Vector2(-15, y - 2) * s, center + Vector2(-11, y) * s,
center + Vector2(-15, y + 2) * s,
]), _active_color(), pulse, core_color)
func _draw_build(center: Vector2, pulse: float, s: float) -> void:
# A plus inside a frame - "add a structure".
var r: float = 11.0 * s