Highlight selected ship lab cards
This commit is contained in:
parent
d20a62a26f
commit
8f7b58f2a8
3 changed files with 27 additions and 4 deletions
|
|
@ -35,6 +35,10 @@ const REFERENCE_SIZE: float = 56.0
|
|||
|
||||
@export var icon: int = Icon.MAP
|
||||
@export var glow_color: Color = Color(0.25, 0.85, 1.0)
|
||||
# Selection is an additional frame, never a recolour. It lets menus retain
|
||||
# semantic colours (vessel class, danger, cargo) while still making the
|
||||
# active choice unmistakable.
|
||||
@export var highlighted: bool = false: set = set_highlighted
|
||||
# Colour of the bright core stroke. Defaults to near-white, which reads well
|
||||
# on the dark space background; scenes drawing over a bright backdrop (the
|
||||
# lunar surface) override this with a dark colour so the button doesn't wash
|
||||
|
|
@ -56,6 +60,13 @@ func set_enabled(value: bool) -> void:
|
|||
queue_redraw()
|
||||
|
||||
|
||||
func set_highlighted(value: bool) -> void:
|
||||
if highlighted == value:
|
||||
return
|
||||
highlighted = value
|
||||
queue_redraw()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
queue_redraw()
|
||||
|
||||
|
|
@ -126,6 +137,16 @@ func _draw() -> void:
|
|||
Vector2(margin, rect_size.y - margin),
|
||||
])
|
||||
NeonDraw.draw_glowing_polygon(self, square, _active_color(), pulse, core_color)
|
||||
if highlighted:
|
||||
# The inset frame reads as a selection focus ring. It deliberately uses
|
||||
# the bright core rather than the button's glow colour, so selecting a
|
||||
# blue shield or pink transporter does not change what that colour means.
|
||||
var inset: float = 10.0 * s
|
||||
var focus: PackedVector2Array = PackedVector2Array([
|
||||
Vector2(inset, inset), Vector2(rect_size.x - inset, inset),
|
||||
Vector2(rect_size.x - inset, rect_size.y - inset), Vector2(inset, rect_size.y - inset),
|
||||
])
|
||||
NeonDraw.draw_glowing_polygon(self, focus, core_color, 1.0, core_color, 0.72 * s)
|
||||
|
||||
var center: Vector2 = rect_size / 2.0
|
||||
match icon:
|
||||
|
|
|
|||
Loading…
Reference in a new issue