fix(theme): showcase renders when run — viewport-fit + display config

Two root causes behind the blank F6 run:
1. project.godot had no display/stretch config (README mandates canvas_items
   @ 1920x1080). Added [display] window size + stretch mode/aspect — the
   project's canvas foundation, needed by every screen.
2. A root Control run directly (F6) is not sized to the viewport by full-rect
   anchors — it collapses to (0,0), clipping the ScrollContainer and hiding all
   content. Size the root to the viewport explicitly and track size_changed
   (dropping the full-rect anchors, which conflict with setting size directly).

Faithful main-scene run now measures root = scroll = viewport = 1920x1080.
Suite 125/125.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 23:11:34 -05:00
parent 0c12e13ac1
commit 4a32e7df8a
2 changed files with 17 additions and 1 deletions

View File

@@ -13,3 +13,10 @@ config_version=5
config/name="coc-rpg"
config/description="AI-driven single-player party RPG. Code owns state. AI owns text."
config/features=PackedStringArray("4.7")
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/stretch/mode="canvas_items"
window/stretch/aspect="keep"

View File

@@ -8,7 +8,12 @@ const SERIF_ITALIC := "res://assets/theme/fonts/EBGaramond-Italic-VariableFont_w
func _ready() -> void:
theme = load(GAME_THEME)
set_anchors_preset(Control.PRESET_FULL_RECT)
# A root Control run directly (F6) is not reliably sized to the viewport by
# full-rect anchors — it collapses to (0,0), clipping the ScrollContainer and
# hiding everything. Size to the viewport explicitly (no full-rect anchors here:
# they conflict with setting `size` directly) and track resizes.
_fit_to_viewport()
get_viewport().size_changed.connect(_fit_to_viewport)
var scroll := ScrollContainer.new()
scroll.set_anchors_preset(Control.PRESET_FULL_RECT)
add_child(scroll)
@@ -27,6 +32,10 @@ func _ready() -> void:
col.add_child(_surfaces())
func _fit_to_viewport() -> void:
size = get_viewport_rect().size
func _heading(text: String) -> Label:
var l := Label.new()
l.text = text