fix: complete Task 5 visual HUD validation

This commit is contained in:
goose
2026-10-08 21:45:46 -04:00
parent 9921e02de3
commit 122fdac97c
7 changed files with 155 additions and 6 deletions
+30 -1
View File
@@ -13,6 +13,7 @@ const QUEST_BOARD_PROMPT := "Espace — Lire le tableau des quêtes"
const REFERENCE_VIEWPORT := Vector2(1920.0, 1080.0)
const MIN_LAYOUT_SCALE := 0.66
const MIN_FONT_SCALE := 0.66
@onready var player_health_label: Label = $PlayerHealthLabel
@onready var player_focus_label: Label = $PlayerFocusLabel
@@ -75,10 +76,11 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
_set_rect($ResponsiveLayout/PromptPanel, origin + Vector2(525, 976) * scale, Vector2(600, 34) * scale)
_set_rect($ResponsiveLayout/HelpPanel, origin + Vector2(1125, 976) * scale, Vector2(775, 82) * scale)
_set_rect($ResponsiveLayout/QuickSlotStrip, origin + Vector2(20, 976) * scale, Vector2(490, 82) * scale)
_apply_text_scale(scale)
_set_rect($AchievementToast, origin + Vector2(420, 16) * scale, Vector2(1080, 28) * scale)
_set_rect($TitleLabel, origin + Vector2(420, 47) * scale, Vector2(1080, 30) * scale)
_set_rect($HeaderValuesLabel, origin + Vector2(420, 78) * scale, Vector2(1080, 24) * scale)
_set_rect($HeaderValuesLabel, origin + Vector2(420, 75) * scale, Vector2(1080, 24) * scale)
_set_rect($ResponsiveLayout/HeaderOrnament, origin + Vector2(560, 12) * scale, Vector2(800, 54) * scale)
_set_rect($ResponsiveLayout/PortraitIllustration, origin + Vector2(45, 145) * scale, Vector2(127, 140) * scale)
@@ -108,6 +110,33 @@ func _set_rect(control: Control, position: Vector2, control_size: Vector2) -> vo
control.position = position
control.size = control_size
func _apply_text_scale(layout_scale: float) -> void:
var font_scale := clampf(layout_scale, MIN_FONT_SCALE, 1.0)
for control: Control in [
$AchievementToast,
$TitleLabel,
$HeaderValuesLabel,
$ResponsiveLayout/QuickSlotHint,
$PlayerHealthLabel,
$PlayerFocusLabel,
$ExperienceLabel,
$CharacterStatusLabel,
$GoldLabel,
$QuestTrackerLabel,
$SpellLabel,
$EnemyHealthLabel,
$CombatSummaryLabel,
$DeadlineLabel,
$EventLog,
$ContextPromptLabel,
$HelpLabel,
]:
var base_size: int = control.get_meta(&"base_font_size", 0)
if base_size == 0:
base_size = control.get_theme_font_size(&"font_size")
control.set_meta(&"base_font_size", base_size)
control.add_theme_font_size_override(&"font_size", roundi(base_size * font_scale))
func _layout_expanded_log(origin: Vector2, scale: float) -> void:
_set_rect(log_panel, origin + Vector2(1580, 122) * scale, Vector2(320, 826) * scale)
_set_rect(event_log, origin + Vector2(1600, 145) * scale, Vector2(280, 775) * scale)