Compare commits
10
Commits
e6025317e1
...
c235dab643
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c235dab643 | ||
|
|
f9934530e1 | ||
|
|
c779c796ec | ||
|
|
f6e93159c0 | ||
|
|
23acd47495 | ||
|
|
cf102e1e95 | ||
|
|
122fdac97c | ||
|
|
9921e02de3 | ||
|
|
27edac9a2f | ||
|
|
80ecc836c2 |
@@ -20,7 +20,7 @@ All binary art below is an unmodified 32×32 PNG copied from the local **Dungeon
|
||||
|
||||
## Dark fantasy UI kit — Task 1
|
||||
|
||||
Reusable UI components copied from the local prototype kit documented in `/home/hectelyon/Downloads/DungeonCrawlerWorld_UI_Assets/README.md`. Only transparent reusable components were imported, plus the two explicitly requested captures (`portrait_roger.png`, `illustration_equipement.png`). Import presets keep UI textures uncompressed, without mipmaps, and do not scale/recolor them with editor settings for pixel-stable UI rendering.
|
||||
Reusable UI components copied from the local prototype kit documented by the portable pack identifier `DungeonCrawlerWorld_UI_Assets/README.md`. Only transparent reusable components were imported, plus the two explicitly requested captures (`portrait_roger.png`, `illustration_equipement.png`). Import presets keep UI textures uncompressed, without mipmaps, and do not scale/recolor them with editor settings for pixel-stable UI rendering.
|
||||
|
||||
| Imported path | Local source | Author / pack | License | Modification / intended use |
|
||||
|---|---|---|---|---|
|
||||
|
||||
@@ -92,6 +92,14 @@ corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_opaque_outside_artboard"]
|
||||
bg_color = Color(0.012, 0.018, 0.028, 1)
|
||||
border_width_left = 1
|
||||
border_width_top = 1
|
||||
border_width_right = 1
|
||||
border_width_bottom = 1
|
||||
border_color = Color(0.19, 0.15, 0.09, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_play_frame"]
|
||||
bg_color = Color(0.008, 0.012, 0.018, 0.0)
|
||||
border_width_left = 3
|
||||
@@ -240,6 +248,7 @@ text = "Sans-Nom • Étage 0 • Salle inconnue • 0 cases explorées"
|
||||
|
||||
[node name="ResponsiveLayout" type="Control" parent="HUD"]
|
||||
layout_mode = 3
|
||||
z_index = -1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@@ -252,6 +261,30 @@ theme = ExtResource("36_hud_theme")
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Artboard" type="Control" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="LetterboxTop" type="Panel" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBox_opaque_outside_artboard")
|
||||
|
||||
[node name="LetterboxBottom" type="Panel" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBox_opaque_outside_artboard")
|
||||
|
||||
[node name="PillarboxLeft" type="Panel" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBox_opaque_outside_artboard")
|
||||
|
||||
[node name="PillarboxRight" type="Panel" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBox_opaque_outside_artboard")
|
||||
|
||||
[node name="TopBar" type="Panel" parent="HUD/ResponsiveLayout"]
|
||||
layout_mode = 0
|
||||
mouse_filter = 2
|
||||
|
||||
+36
-25
@@ -3,27 +3,23 @@
|
||||
[ext_resource type="Script" path="res://scripts/presentation/minimap.gd" id="1_minimap"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_minimap"]
|
||||
bg_color = Color(0.025, 0.045, 0.085, 0.94)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.45, 0.75, 0.9, 0.9)
|
||||
corner_radius_top_left = 6
|
||||
corner_radius_top_right = 6
|
||||
corner_radius_bottom_right = 6
|
||||
corner_radius_bottom_left = 6
|
||||
bg_color = Color(0.045, 0.035, 0.025, 0.96)
|
||||
border_width_left = 3
|
||||
border_width_top = 3
|
||||
border_width_right = 3
|
||||
border_width_bottom = 3
|
||||
border_color = Color(0.67, 0.48, 0.19, 0.95)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
shadow_color = Color(0, 0, 0, 0.55)
|
||||
shadow_size = 5
|
||||
|
||||
[node name="Minimap" type="Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -188.0
|
||||
offset_top = 184.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = 352.0
|
||||
grow_horizontal = 0
|
||||
offset_right = 280.0
|
||||
offset_bottom = 300.0
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_minimap")
|
||||
|
||||
@@ -43,13 +39,28 @@ layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -70.0
|
||||
offset_top = 4.0
|
||||
offset_right = 70.0
|
||||
offset_bottom = 20.0
|
||||
offset_left = -120.0
|
||||
offset_top = 7.0
|
||||
offset_right = 120.0
|
||||
offset_bottom = 29.0
|
||||
grow_horizontal = 2
|
||||
theme_override_colors/font_color = Color(0.78, 0.94, 1, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "CARTE — Tab"
|
||||
theme_override_colors/font_color = Color(0.86, 0.78, 0.58, 1)
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "CARTOGRAPHIE — TAB"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="MapRegion" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 14.0
|
||||
offset_top = 40.0
|
||||
offset_right = -14.0
|
||||
offset_bottom = -14.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
clip_contents = true
|
||||
|
||||
@@ -13,11 +13,16 @@ import sys
|
||||
import zlib
|
||||
from pathlib import Path
|
||||
|
||||
WIDTH = 1920
|
||||
HEIGHT = 1080
|
||||
# Central dungeon measurement region, proportionally equivalent to the former
|
||||
# 16:9 reference crop while excluding the anchored HUD panels.
|
||||
VIEWPORT = (384, 60, 1536, 1017)
|
||||
REFERENCE_WIDTH = 1920
|
||||
REFERENCE_HEIGHT = 1080
|
||||
EXPECTED_DIMENSIONS = {
|
||||
"visual-check.png": (REFERENCE_WIDTH, REFERENCE_HEIGHT),
|
||||
"visual-check-exit.png": (REFERENCE_WIDTH, REFERENCE_HEIGHT),
|
||||
"visual-check-compact.png": (1280, 720),
|
||||
}
|
||||
# Central dungeon measurement region in the reference 1920×1080 artboard.
|
||||
# It excludes the anchored HUD panels and is scaled for the real 720p capture.
|
||||
REFERENCE_VIEWPORT = (384, 60, 1536, 1017)
|
||||
UNKNOWN = (1, 2, 5)
|
||||
# Captured explored tiles are texture modulated, so classify their blue-black
|
||||
# pixels by palette range rather than expecting one flat overlay color.
|
||||
@@ -70,8 +75,14 @@ def read_png(path: Path) -> tuple[int, int, list[bytes]]:
|
||||
if header is None or not saw_iend or offset != len(data):
|
||||
fail("incomplete PNG")
|
||||
width, height, depth, color_type, compression, filtering, interlace = header
|
||||
if (width, height) != (WIDTH, HEIGHT):
|
||||
fail(f"expected {WIDTH}x{HEIGHT} PNG, got {width}x{height}")
|
||||
expected_dimensions = EXPECTED_DIMENSIONS.get(path.name)
|
||||
if expected_dimensions is None:
|
||||
fail(f"unsupported visual capture name: {path.name}")
|
||||
if (width, height) != expected_dimensions:
|
||||
fail(
|
||||
f"expected {expected_dimensions[0]}x{expected_dimensions[1]} PNG, "
|
||||
f"got {width}x{height}"
|
||||
)
|
||||
if depth != 8 or color_type not in (2, 6):
|
||||
fail("visual capture must be an 8-bit RGB or RGBA PNG")
|
||||
if (compression, filtering, interlace) != (0, 0, 0):
|
||||
@@ -154,18 +165,28 @@ def is_visible(pixel: tuple[int, int, int]) -> bool:
|
||||
|
||||
|
||||
def is_explored(pixel: tuple[int, int, int]) -> bool:
|
||||
# Tile texture remains visible under a blue-black fog overlay. This is the
|
||||
# dominant fog-modulated floor texel; keeping the detector exact avoids HUD
|
||||
# colors and visible terrain satisfying it.
|
||||
return pixel == (19, 29, 39)
|
||||
# Texture-preserving explored terrain is rendered under a blue-black fog
|
||||
# overlay. GPU blend rounding and the authored floor texture produce a
|
||||
# palette rather than one portable exact RGB value; accept only its dark,
|
||||
# blue-shifted range so HUD chrome and visible brown terrain cannot match.
|
||||
red, green, blue = pixel
|
||||
return 4 <= red <= 14 and 8 <= green <= 22 and 17 <= blue <= 32 and blue >= green + 4 and green >= red + 3
|
||||
|
||||
|
||||
def viewport_for(width: int, height: int) -> tuple[int, int, int, int]:
|
||||
scale_x = width / REFERENCE_WIDTH
|
||||
scale_y = height / REFERENCE_HEIGHT
|
||||
return tuple(round(coordinate * (scale_x if index % 2 == 0 else scale_y)) for index, coordinate in enumerate(REFERENCE_VIEWPORT))
|
||||
|
||||
|
||||
def measure(path: Path) -> None:
|
||||
width, height = EXPECTED_DIMENSIONS[path.name]
|
||||
observed = list(pixels(path))
|
||||
viewport = viewport_for(width, height)
|
||||
dungeon_pixels = [
|
||||
observed[y * WIDTH + x]
|
||||
for y in range(VIEWPORT[1], VIEWPORT[3])
|
||||
for x in range(VIEWPORT[0], VIEWPORT[2])
|
||||
observed[y * width + x]
|
||||
for y in range(viewport[1], viewport[3])
|
||||
for x in range(viewport[0], viewport[2])
|
||||
]
|
||||
non_black = sum(pixel != (0, 0, 0) for pixel in dungeon_pixels)
|
||||
unknown_pixels = [pixel for pixel in dungeon_pixels if pixel == UNKNOWN]
|
||||
|
||||
+15
-1
@@ -302,6 +302,8 @@ func _get_capture_mode() -> String:
|
||||
var arguments := OS.get_cmdline_user_args()
|
||||
if "--capture-exit" in arguments:
|
||||
return "exit"
|
||||
if "--visual-check-compact" in arguments:
|
||||
return "compact"
|
||||
if "--capture" in arguments:
|
||||
return "initial"
|
||||
return ""
|
||||
@@ -309,10 +311,17 @@ func _get_capture_mode() -> String:
|
||||
func _capture_visual_check(capture_mode: String) -> void:
|
||||
if capture_mode == "exit":
|
||||
_prepare_exit_capture_state()
|
||||
# Camera2D applies its scroll during the frame cycle. Force it before the
|
||||
# deterministic capture so the world is framed around the capture state.
|
||||
camera.force_update_scroll()
|
||||
await get_tree().process_frame
|
||||
await get_tree().process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
var filename := "visual-check-exit.png" if capture_mode == "exit" else "visual-check.png"
|
||||
var filename := "visual-check.png"
|
||||
if capture_mode == "exit":
|
||||
filename = "visual-check-exit.png"
|
||||
elif capture_mode == "compact":
|
||||
filename = "visual-check-compact.png"
|
||||
var capture_path := ProjectSettings.globalize_path("res://artifacts/" + filename)
|
||||
DirAccess.make_dir_recursive_absolute(capture_path.get_base_dir())
|
||||
var image := get_viewport().get_texture().get_image()
|
||||
@@ -326,6 +335,11 @@ func _prepare_exit_capture_state() -> void:
|
||||
game_state.map.set_cell(Vector2i(36, 7), GridMapStateType.CellKind.FLOOR)
|
||||
game_state.player.cell = game_state.floor_state.exit
|
||||
game_state.update_exploration()
|
||||
# Keep a nearby floor tile as remembered terrain. The entrance is outside
|
||||
# the exit camera crop, so it cannot prove the explored-fog render contract.
|
||||
var remembered_cell := game_state.floor_state.exit + Vector2i(-2, 0)
|
||||
game_state.explored_cells[remembered_cell] = true
|
||||
game_state.visible_cells.erase(remembered_cell)
|
||||
_sync_map_renderer_visibility()
|
||||
_sync_minimap()
|
||||
player_view.refresh()
|
||||
|
||||
@@ -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
|
||||
@@ -59,9 +60,18 @@ func apply_viewport_layout(viewport_size: Vector2) -> void:
|
||||
var artboard_size := REFERENCE_VIEWPORT * scale
|
||||
var origin := (viewport_size - artboard_size) * 0.5
|
||||
|
||||
# Keep the authored HUD on one centered 16:9 artboard. The opaque dark-fantasy
|
||||
# bands mask every pixel outside it, rather than allowing the world to show in
|
||||
# letterbox or pillarbox space on non-16:9 displays.
|
||||
_set_rect($ResponsiveLayout/DarkBackdrop, Vector2.ZERO, viewport_size)
|
||||
_set_rect($ResponsiveLayout/Artboard, origin, artboard_size)
|
||||
_set_rect($ResponsiveLayout/LetterboxTop, Vector2.ZERO, Vector2(viewport_size.x, origin.y))
|
||||
_set_rect($ResponsiveLayout/LetterboxBottom, Vector2(0.0, origin.y + artboard_size.y), Vector2(viewport_size.x, origin.y))
|
||||
_set_rect($ResponsiveLayout/PillarboxLeft, Vector2(0.0, origin.y), Vector2(origin.x, artboard_size.y))
|
||||
_set_rect($ResponsiveLayout/PillarboxRight, Vector2(origin.x + artboard_size.x, origin.y), Vector2(origin.x, artboard_size.y))
|
||||
|
||||
# CanvasLayer controls paint over the world; the play frame is deliberately
|
||||
# border-only so its center remains the unobscured gameplay viewport.
|
||||
_set_rect($ResponsiveLayout/DarkBackdrop, Vector2.ZERO, viewport_size)
|
||||
_set_rect($ResponsiveLayout/TopBar, origin + Vector2(20, 10) * scale, Vector2(1880, 100) * scale)
|
||||
_set_rect($ResponsiveLayout/LeftRail, origin + Vector2(20, 122) * scale, Vector2(320, 826) * scale)
|
||||
_set_rect($ResponsiveLayout/PlayAreaFrame, origin + Vector2(370, 125) * scale, Vector2(1180, 830) * scale)
|
||||
@@ -75,10 +85,16 @@ 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)
|
||||
# Minimap owns its compact/expanded sizing, but must consume the freshly sized
|
||||
# rail before any frame is rendered at a new viewport size.
|
||||
var minimap := get_node_or_null("Minimap") as Control
|
||||
if minimap != null:
|
||||
minimap.call("_layout_in_hud")
|
||||
_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 +124,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)
|
||||
|
||||
@@ -33,7 +33,7 @@ func _ready() -> void:
|
||||
|
||||
func _get_capture_mode() -> bool:
|
||||
var arguments := OS.get_cmdline_user_args()
|
||||
return "--capture" in arguments or "--capture-exit" in arguments
|
||||
return "--capture" in arguments or "--capture-exit" in arguments or "--visual-check-compact" in arguments
|
||||
|
||||
func _show_character_creation() -> void:
|
||||
menu.visible = false
|
||||
|
||||
@@ -2,12 +2,17 @@ class_name Minimap
|
||||
extends Control
|
||||
|
||||
const CROP_RADIUS := 6
|
||||
const CELL_SIZE := 12.0
|
||||
const UNKNOWN_COLOR := Color(0.025, 0.04, 0.09, 0.94)
|
||||
const EXPLORED_COLOR := Color(0.18, 0.32, 0.48, 0.96)
|
||||
const VISIBLE_COLOR := Color(0.72, 0.84, 0.9, 1.0)
|
||||
const PLAYER_COLOR := Color(1.0, 0.92, 0.32, 1.0)
|
||||
const THREAT_COLOR := Color(0.95, 0.42, 0.18, 1.0)
|
||||
const UNKNOWN_COLOR := Color(0.035, 0.03, 0.025, 0.96)
|
||||
const EXPLORED_COLOR := Color(0.24, 0.29, 0.25, 0.98)
|
||||
const VISIBLE_COLOR := Color(0.72, 0.66, 0.51, 1.0)
|
||||
const PLAYER_COLOR := Color(0.96, 0.78, 0.3, 1.0)
|
||||
const THREAT_COLOR := Color(0.84, 0.22, 0.14, 1.0)
|
||||
const COMPACT_SIZE := Vector2(280.0, 300.0)
|
||||
const EXPANDED_SIZE := Vector2(520.0, 560.0)
|
||||
const COMPACT_RAIL_INSET := 20.0
|
||||
const EXPANDED_FRAME_INSET := 28.0
|
||||
|
||||
@onready var map_region: Control = $MapRegion
|
||||
|
||||
var expanded := false
|
||||
var _crop_radius := CROP_RADIUS
|
||||
@@ -17,6 +22,17 @@ var _visible_cells: Dictionary[Vector2i, bool] = {}
|
||||
var _explored_cells: Dictionary[Vector2i, bool] = {}
|
||||
var _threat_cells: Dictionary[Vector2i, bool] = {}
|
||||
|
||||
func _ready() -> void:
|
||||
resized.connect(queue_redraw)
|
||||
map_region.resized.connect(queue_redraw)
|
||||
get_viewport().size_changed.connect(_on_viewport_size_changed)
|
||||
call_deferred("_layout_in_hud")
|
||||
|
||||
func _on_viewport_size_changed() -> void:
|
||||
# GameHud updates the rail rectangles from the same signal; defer until those
|
||||
# rectangles have received their new responsive dimensions.
|
||||
call_deferred("_layout_in_hud")
|
||||
|
||||
func set_state(map: GridMapState, player_cell: Vector2i, visible_cells: Dictionary[Vector2i, bool], explored_cells: Dictionary[Vector2i, bool], threat_cells: Dictionary[Vector2i, bool]) -> void:
|
||||
_map = map
|
||||
_player_cell = player_cell
|
||||
@@ -49,28 +65,55 @@ func get_cell_visibility_state(cell: Vector2i) -> StringName:
|
||||
|
||||
func get_threat_marker_cells() -> Dictionary[Vector2i, bool]:
|
||||
var threats: Dictionary[Vector2i, bool] = {}
|
||||
var displayed := get_displayed_cells()
|
||||
for cell in _threat_cells:
|
||||
if _visible_cells.has(cell) and get_displayed_cells().has(cell):
|
||||
if _visible_cells.has(cell) and displayed.has(cell):
|
||||
threats[cell] = true
|
||||
return threats
|
||||
|
||||
## Returns the local rectangle exclusively available to map cells and markers.
|
||||
func get_drawable_map_rect() -> Rect2:
|
||||
if not is_instance_valid(map_region):
|
||||
return Rect2()
|
||||
var region_size := map_region.size
|
||||
var square_side := minf(region_size.x, region_size.y)
|
||||
return Rect2(map_region.position + (region_size - Vector2.ONE * square_side) * 0.5, Vector2.ONE * square_side)
|
||||
|
||||
func toggle_expanded() -> void:
|
||||
expanded = not expanded
|
||||
_crop_radius = CROP_RADIUS * 2 if expanded else CROP_RADIUS
|
||||
set_anchors_and_offsets_preset(Control.PRESET_CENTER_TOP if expanded else Control.PRESET_TOP_RIGHT)
|
||||
size = Vector2(312, 312) if expanded else Vector2(168, 168)
|
||||
position = Vector2(484, 72) if expanded else Vector2(-188, 184)
|
||||
_layout_in_hud()
|
||||
queue_redraw()
|
||||
|
||||
func _layout_in_hud() -> void:
|
||||
if not is_inside_tree():
|
||||
return
|
||||
var layout := get_node_or_null("../ResponsiveLayout") as Control
|
||||
if layout == null:
|
||||
return
|
||||
var host := layout.get_node_or_null("PlayAreaFrame" if expanded else "RightRail") as Control
|
||||
if host == null:
|
||||
return
|
||||
var requested_size := EXPANDED_SIZE if expanded else COMPACT_SIZE
|
||||
var inset := EXPANDED_FRAME_INSET if expanded else COMPACT_RAIL_INSET
|
||||
var available_size := host.size - Vector2.ONE * inset * 2.0
|
||||
var panel_size := Vector2(minf(requested_size.x, available_size.x), minf(requested_size.y, available_size.y))
|
||||
size = panel_size
|
||||
position = host.position + (host.size - panel_size) * 0.5
|
||||
|
||||
func _draw() -> void:
|
||||
if _map == null:
|
||||
return
|
||||
var drawable_rect := get_drawable_map_rect()
|
||||
if drawable_rect.size.x <= 0.0 or drawable_rect.size.y <= 0.0:
|
||||
return
|
||||
var displayed := get_displayed_cells()
|
||||
var threat_cells := get_threat_marker_cells()
|
||||
var cells_across := _crop_radius * 2 + 1
|
||||
var draw_cell_size := size.x / float(cells_across)
|
||||
var draw_cell_size := drawable_rect.size.x / float(cells_across)
|
||||
for cell in displayed:
|
||||
var local := cell - _player_cell + Vector2i(cells_across / 2, cells_across / 2)
|
||||
var rect := Rect2(Vector2(local) * draw_cell_size, Vector2.ONE * (draw_cell_size - 1.0))
|
||||
var local := cell - _player_cell + Vector2i(_crop_radius, _crop_radius)
|
||||
var rect := Rect2(drawable_rect.position + Vector2(local) * draw_cell_size, Vector2.ONE * (draw_cell_size - 1.0))
|
||||
var color := UNKNOWN_COLOR
|
||||
if get_cell_visibility_state(cell) == &"visible":
|
||||
color = VISIBLE_COLOR
|
||||
@@ -79,5 +122,5 @@ func _draw() -> void:
|
||||
draw_rect(rect, color)
|
||||
if cell == _player_cell:
|
||||
draw_circle(rect.get_center(), draw_cell_size * 0.28, PLAYER_COLOR)
|
||||
elif get_threat_marker_cells().has(cell):
|
||||
elif threat_cells.has(cell):
|
||||
draw_circle(rect.get_center(), draw_cell_size * 0.25, THREAT_COLOR)
|
||||
|
||||
@@ -18,7 +18,8 @@ mkdir -p artifacts
|
||||
log_path="artifacts/visual-check.log"
|
||||
initial_capture_path="artifacts/visual-check.png"
|
||||
exit_capture_path="artifacts/visual-check-exit.png"
|
||||
rm -f "$initial_capture_path" "$exit_capture_path"
|
||||
compact_capture_path="artifacts/visual-check-compact.png"
|
||||
rm -f "$initial_capture_path" "$exit_capture_path" "$compact_capture_path"
|
||||
: > "$log_path"
|
||||
|
||||
runner=()
|
||||
@@ -34,8 +35,9 @@ fi
|
||||
run_capture() {
|
||||
local label="$1"
|
||||
local capture_argument="$2"
|
||||
shift 2
|
||||
set +e
|
||||
timeout --foreground 20s "${runner[@]}" "$GODOT_BIN" --path . -- --"$capture_argument" >>"$log_path" 2>&1
|
||||
timeout --foreground 20s "${runner[@]}" "$GODOT_BIN" --path . "$@" -- --"$capture_argument" >>"$log_path" 2>&1
|
||||
local status=$?
|
||||
set -e
|
||||
if (( status != 0 )); then
|
||||
@@ -46,6 +48,10 @@ run_capture() {
|
||||
|
||||
run_capture "initial" "capture"
|
||||
run_capture "exit" "capture-exit"
|
||||
# This is a real 1280×720 window capture, not a unit-level HUD relayout call.
|
||||
# The fixed window size makes the compact artboard and PNG reproducible under
|
||||
# Xvfb as well as an interactive DISPLAY.
|
||||
run_capture "compact" "visual-check-compact" --windowed --resolution 1280x720
|
||||
# Godot's SCRIPT ERROR / Parse Error diagnostics are actionable application
|
||||
# failures. Do not treat unrelated backend diagnostics (for example the
|
||||
# expected xkbcommon Compose warnings emitted by some Snap/Xvfb setups) as an
|
||||
@@ -65,3 +71,4 @@ measure_capture() {
|
||||
|
||||
measure_capture "$initial_capture_path"
|
||||
measure_capture "$exit_capture_path"
|
||||
measure_capture "$compact_capture_path"
|
||||
|
||||
@@ -17,9 +17,11 @@ if [[ " $* " == *" --import "* ]]; then
|
||||
printf '%s\n' "fake import output" >&2
|
||||
exit "${FAKE_IMPORT_STATUS:-0}"
|
||||
fi
|
||||
if [[ " $* " == *" --capture "* || " $* " == *" --capture-exit "* ]]; then
|
||||
if [[ " $* " == *" --capture "* || " $* " == *" --capture-exit "* || " $* " == *" --visual-check-compact "* ]]; then
|
||||
if [[ " $* " == *" --capture-exit "* ]]; then
|
||||
capture_name="visual-check-exit.png"
|
||||
elif [[ " $* " == *" --visual-check-compact "* ]]; then
|
||||
capture_name="visual-check-compact.png"
|
||||
else
|
||||
capture_name="visual-check.png"
|
||||
fi
|
||||
@@ -30,10 +32,13 @@ import sys
|
||||
import zlib
|
||||
|
||||
os.makedirs("artifacts", exist_ok=True)
|
||||
width, height = 1920, 1080
|
||||
compact = sys.argv[1] == "visual-check-compact.png"
|
||||
width, height = (1280, 720) if compact else (1920, 1080)
|
||||
unknown = (1, 2, 5)
|
||||
visible = (176, 176, 176)
|
||||
explored = (19, 29, 39)
|
||||
# Match the blue-black explored tile palette accepted by the real capture
|
||||
# validator; do not model it as a single renderer-specific RGB tuple.
|
||||
explored = (9, 14, 23)
|
||||
def pixel_for_x(x):
|
||||
if x < width // 3:
|
||||
return unknown
|
||||
@@ -72,6 +77,18 @@ assert_import_precedes_run() {
|
||||
}
|
||||
}
|
||||
|
||||
visual_log="$tmp_dir/run-visual-check.sh.log"
|
||||
FAKE_GODOT_LOG="$visual_log" GODOT_BIN="$fake_godot" DISPLAY=:99 "$project_dir/scripts/run-visual-check.sh"
|
||||
compact_run="$(grep -- '--visual-check-compact' "$visual_log")"
|
||||
[[ "$compact_run" == *"--windowed"* && "$compact_run" == *"--resolution 1280x720"* ]] || {
|
||||
echo "run-visual-check.sh did not request a real 1280x720 compact window" >&2
|
||||
exit 1
|
||||
}
|
||||
[[ -s "$project_dir/artifacts/visual-check-compact.png" ]] || {
|
||||
echo "run-visual-check.sh did not produce a compact capture" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
assert_import_precedes_run test-unit.sh
|
||||
assert_import_precedes_run test-e2e.sh
|
||||
assert_import_precedes_run run-visual-check.sh
|
||||
|
||||
@@ -58,6 +58,15 @@ func test_map_renderer_returns_the_contract_cell_rectangle() -> void:
|
||||
|
||||
assert_eq(renderer.get_cell_rect(Vector2i(2, 3)), Rect2(64, 96, 32, 32))
|
||||
|
||||
func test_minimap_root_is_enclosed_by_the_right_rail_at_reference_viewport() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
var minimap := game.get_node("HUD/Minimap") as Minimap
|
||||
var right_rail := game.get_node("HUD/ResponsiveLayout/RightRail") as Control
|
||||
|
||||
assert_true(right_rail.get_global_rect().encloses(minimap.get_global_rect()))
|
||||
|
||||
func test_camera_tracks_player_after_a_valid_action_and_uses_map_limits() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
add_child_autofree(game)
|
||||
|
||||
@@ -191,9 +191,15 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
|
||||
var header_text := _combined_label_text(header_values)
|
||||
var character_text := _combined_label_text(character_values)
|
||||
var expected_room_id := ""
|
||||
for room: RoomState in state.floor_state.rooms:
|
||||
if room.bounds.has_point(state.player.cell):
|
||||
expected_room_id = String(room.id)
|
||||
break
|
||||
assert_ne(expected_room_id, "", "The player's authored room must be discoverable from its bounds")
|
||||
assert_string_contains(header_text, run.player_name)
|
||||
assert_string_contains(header_text, str(state.floor_state.floor_number))
|
||||
assert_string_contains(header_text, String(state.floor_state.room_at(state.player.cell).id))
|
||||
assert_string_contains(header_text, expected_room_id)
|
||||
assert_string_contains(header_text, str(state.explored_cells.size()))
|
||||
assert_string_contains(character_text, str(state.player.hit_points))
|
||||
_assert_controls_enclosed(top_bar, header_values, "TopBar")
|
||||
@@ -205,6 +211,165 @@ func test_dynamic_hud_groups_refresh_from_live_game_values() -> void:
|
||||
assert_string_contains(_combined_label_text(command_hints), "Ouvrir la porte")
|
||||
_assert_controls_enclosed(command_bar, command_hints, "CommandBar")
|
||||
|
||||
func test_compact_1280_layout_scales_header_text_and_keeps_it_inside_the_top_bar() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
|
||||
hud.apply_viewport_layout(Vector2(1280, 720))
|
||||
var top_bar := hud.get_node_or_null("ResponsiveLayout/TopBar") as Control
|
||||
var header := hud.get_node_or_null("HeaderValuesLabel") as Label
|
||||
assert_not_null(top_bar, "ResponsiveLayout requires a TopBar")
|
||||
assert_not_null(header, "HUD requires HeaderValuesLabel")
|
||||
if top_bar == null or header == null:
|
||||
return
|
||||
|
||||
assert_eq(header.get_theme_font_size(&"font_size"), 11, "The compact shell scales the 16px header value font to the 1280x720 artboard")
|
||||
assert_true(top_bar.get_global_rect().encloses(header.get_global_rect()), "The compact header remains inside its TopBar")
|
||||
assert_lte(header.get_minimum_size().y, header.size.y, "The compact header has enough height for its scaled text")
|
||||
|
||||
func test_compact_1280_layout_contains_live_hud_regions_without_covering_the_play_area() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
|
||||
hud.apply_viewport_layout(Vector2(1280, 720))
|
||||
await get_tree().process_frame
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var minimap := hud.get_node_or_null("Minimap") as Minimap
|
||||
assert_not_null(layout, "HUD requires ResponsiveLayout")
|
||||
assert_not_null(minimap, "HUD requires its live minimap")
|
||||
if layout == null or minimap == null:
|
||||
return
|
||||
var top_bar := layout.get_node_or_null("TopBar") as Control
|
||||
var left_rail := layout.get_node_or_null("LeftRail") as Control
|
||||
var play_area := layout.get_node_or_null("PlayAreaFrame") as Control
|
||||
var right_rail := layout.get_node_or_null("RightRail") as Control
|
||||
var command_bar := layout.get_node_or_null("CommandBar") as Control
|
||||
var stats_panel := layout.get_node_or_null("StatsPanel") as Control
|
||||
var log_panel := layout.get_node_or_null("LogPanel") as Control
|
||||
var prompt_panel := layout.get_node_or_null("PromptPanel") as Control
|
||||
var help_panel := layout.get_node_or_null("HelpPanel") as Control
|
||||
var quick_slots := layout.get_node_or_null("QuickSlotStrip") as Control
|
||||
assert_not_null(top_bar)
|
||||
assert_not_null(left_rail)
|
||||
assert_not_null(play_area)
|
||||
assert_not_null(right_rail)
|
||||
assert_not_null(command_bar)
|
||||
assert_not_null(stats_panel)
|
||||
assert_not_null(log_panel)
|
||||
assert_not_null(prompt_panel)
|
||||
assert_not_null(help_panel)
|
||||
assert_not_null(quick_slots)
|
||||
if top_bar == null or left_rail == null or play_area == null or right_rail == null or command_bar == null or stats_panel == null or log_panel == null or prompt_panel == null or help_panel == null or quick_slots == null:
|
||||
return
|
||||
|
||||
_assert_controls_enclosed(top_bar, [
|
||||
hud.get_node_or_null("AchievementToast") as Control,
|
||||
hud.get_node_or_null("TitleLabel") as Control,
|
||||
hud.get_node_or_null("HeaderValuesLabel") as Control,
|
||||
layout.get_node_or_null("HeaderOrnament") as Control,
|
||||
], "compact TopBar")
|
||||
_assert_controls_enclosed(left_rail, [
|
||||
stats_panel,
|
||||
hud.get_node_or_null("PlayerHealthLabel") as Control,
|
||||
hud.get_node_or_null("HealthBar") as Control,
|
||||
hud.get_node_or_null("PlayerFocusLabel") as Control,
|
||||
hud.get_node_or_null("FocusBar") as Control,
|
||||
hud.get_node_or_null("ExperienceBar") as Control,
|
||||
hud.get_node_or_null("ExperienceLabel") as Control,
|
||||
hud.get_node_or_null("CharacterStatusLabel") as Control,
|
||||
hud.get_node_or_null("GoldLabel") as Control,
|
||||
hud.get_node_or_null("QuestTrackerLabel") as Control,
|
||||
hud.get_node_or_null("SpellLabel") as Control,
|
||||
hud.get_node_or_null("EnemyHealthLabel") as Control,
|
||||
hud.get_node_or_null("CombatSummaryLabel") as Control,
|
||||
hud.get_node_or_null("DeadlineLabel") as Control,
|
||||
], "compact LeftRail")
|
||||
_assert_controls_enclosed(right_rail, [
|
||||
log_panel,
|
||||
hud.get_node_or_null("EventLog") as Control,
|
||||
minimap,
|
||||
], "compact RightRail")
|
||||
_assert_controls_enclosed(command_bar, [prompt_panel, help_panel, quick_slots,
|
||||
hud.get_node_or_null("ContextPromptLabel") as Control,
|
||||
hud.get_node_or_null("HelpLabel") as Control,
|
||||
layout.get_node_or_null("QuickSlotHint") as Control,
|
||||
], "compact CommandBar")
|
||||
|
||||
for shell: Control in [top_bar, left_rail, right_rail, command_bar]:
|
||||
assert_false(shell.get_global_rect().intersects(play_area.get_global_rect()), "%s must not cover the compact PlayAreaFrame" % shell.name)
|
||||
assert_false(minimap.get_global_rect().intersects(play_area.get_global_rect()), "The compact minimap must remain off the PlayAreaFrame")
|
||||
|
||||
for label: Label in [
|
||||
hud.get_node_or_null("HeaderValuesLabel") as Label,
|
||||
hud.get_node_or_null("PlayerHealthLabel") as Label,
|
||||
hud.get_node_or_null("PlayerFocusLabel") as Label,
|
||||
hud.get_node_or_null("ExperienceLabel") as Label,
|
||||
hud.get_node_or_null("ContextPromptLabel") as Label,
|
||||
hud.get_node_or_null("HelpLabel") as Label,
|
||||
]:
|
||||
assert_not_null(label)
|
||||
if label != null:
|
||||
assert_gte(label.get_theme_font_size(&"font_size"), 9, "%s must keep a readable compact font" % label.name)
|
||||
var journal := hud.get_node_or_null("EventLog") as RichTextLabel
|
||||
assert_not_null(journal)
|
||||
if journal != null:
|
||||
assert_gte(journal.get_theme_font_size(&"normal_font_size"), 9, "The compact journal font must remain readable")
|
||||
|
||||
func test_non_sixteen_by_nine_viewports_center_the_artboard_and_mask_every_outside_band() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
if hud == null:
|
||||
return
|
||||
|
||||
for viewport_size: Vector2 in [Vector2(1024, 768), Vector2(2560, 1080)]:
|
||||
hud.apply_viewport_layout(viewport_size)
|
||||
var layout := hud.get_node_or_null("ResponsiveLayout") as Control
|
||||
var artboard := layout.get_node_or_null("Artboard") as Control if layout != null else null
|
||||
assert_not_null(artboard, "ResponsiveLayout requires its centered 16:9 Artboard")
|
||||
if layout == null or artboard == null:
|
||||
return
|
||||
var scale := minf(viewport_size.x / GameHud.REFERENCE_VIEWPORT.x, viewport_size.y / GameHud.REFERENCE_VIEWPORT.y)
|
||||
var expected_size := GameHud.REFERENCE_VIEWPORT * scale
|
||||
var expected_origin := (viewport_size - expected_size) * 0.5
|
||||
assert_eq(artboard.position, expected_origin, "The artboard must be centered at %s" % viewport_size)
|
||||
assert_eq(artboard.size, expected_size, "The artboard must preserve a 16:9 size at %s" % viewport_size)
|
||||
|
||||
var artboard_rect := artboard.get_global_rect()
|
||||
for shell_name: String in ["TopBar", "LeftRail", "PlayAreaFrame", "RightRail", "CommandBar"]:
|
||||
var shell := layout.get_node_or_null(shell_name) as Control
|
||||
assert_not_null(shell)
|
||||
if shell != null:
|
||||
assert_true(artboard_rect.encloses(shell.get_global_rect()), "%s must remain inside the 16:9 artboard" % shell_name)
|
||||
|
||||
for band_name: String in ["LetterboxTop", "LetterboxBottom", "PillarboxLeft", "PillarboxRight"]:
|
||||
var band := layout.get_node_or_null(band_name) as Panel
|
||||
assert_not_null(band, "ResponsiveLayout requires %s" % band_name)
|
||||
if band != null and band.size.x > 0.0 and band.size.y > 0.0:
|
||||
var style := band.get_theme_stylebox(&"panel") as StyleBoxFlat
|
||||
assert_not_null(style, "%s needs an explicit opaque panel style" % band_name)
|
||||
if style != null:
|
||||
assert_eq(style.bg_color.a, 1.0, "%s must be opaque so the world cannot show through" % band_name)
|
||||
assert_false(band.get_global_rect().intersects(artboard_rect), "%s must cover only the outside band" % band_name)
|
||||
|
||||
var top := layout.get_node_or_null("LetterboxTop") as Control
|
||||
var bottom := layout.get_node_or_null("LetterboxBottom") as Control
|
||||
var left := layout.get_node_or_null("PillarboxLeft") as Control
|
||||
var right := layout.get_node_or_null("PillarboxRight") as Control
|
||||
if viewport_size == Vector2(1024, 768):
|
||||
assert_eq(top.size, Vector2(1024, 96), "1024x768 needs a fully covered top letterbox")
|
||||
assert_eq(bottom.size, Vector2(1024, 96), "1024x768 needs a fully covered bottom letterbox")
|
||||
assert_eq(left.size.x, 0.0)
|
||||
assert_eq(right.size.x, 0.0)
|
||||
else:
|
||||
assert_eq(left.size, Vector2(320, 1080), "ultrawide needs a fully covered left pillarbox")
|
||||
assert_eq(right.size, Vector2(320, 1080), "ultrawide needs a fully covered right pillarbox")
|
||||
assert_eq(top.size.y, 0.0)
|
||||
assert_eq(bottom.size.y, 0.0)
|
||||
|
||||
func test_long_deadline_text_wraps_and_stays_inside_the_left_rail() -> void:
|
||||
var hud := game.get_node_or_null("HUD") as GameHud
|
||||
assert_not_null(hud, "Game scene requires HUD")
|
||||
|
||||
@@ -9,6 +9,31 @@ func before_each() -> void:
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func test_minimap_lives_in_right_rail_and_draws_only_in_its_inner_map_region() -> void:
|
||||
var minimap := game.get_node_or_null("HUD/Minimap") as Minimap
|
||||
var layout := game.get_node("HUD/ResponsiveLayout") as Control
|
||||
var right_rail := layout.get_node("RightRail") as Control
|
||||
var play_frame := layout.get_node("PlayAreaFrame") as Control
|
||||
var map_region := minimap.get_node("MapRegion") as Control
|
||||
var caption := minimap.get_node("Caption") as Label
|
||||
|
||||
assert_not_null(minimap)
|
||||
assert_true(right_rail.get_global_rect().encloses(minimap.get_global_rect()))
|
||||
assert_true(map_region.get_rect().encloses(minimap.get_drawable_map_rect()))
|
||||
assert_false(caption.get_rect().intersects(minimap.get_drawable_map_rect()))
|
||||
assert_lt(minimap.get_drawable_map_rect().size.x, minimap.size.x)
|
||||
|
||||
minimap.toggle_expanded()
|
||||
await get_tree().process_frame
|
||||
assert_true(minimap.expanded)
|
||||
assert_true(play_frame.get_global_rect().encloses(minimap.get_global_rect()))
|
||||
assert_true(map_region.get_rect().encloses(minimap.get_drawable_map_rect()))
|
||||
|
||||
minimap.toggle_expanded()
|
||||
await get_tree().process_frame
|
||||
assert_false(minimap.expanded)
|
||||
assert_true(right_rail.get_global_rect().encloses(minimap.get_global_rect()))
|
||||
|
||||
func test_minimap_crops_to_player_camera_fov_and_never_reveals_hidden_threats() -> void:
|
||||
var minimap := game.get_node_or_null("HUD/Minimap") as Minimap
|
||||
var state := game.get_game_state()
|
||||
|
||||
Reference in New Issue
Block a user