From 4a32e7df8acde908fca12e1e45c3bf643b627ed4 Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Fri, 10 Jul 2026 23:11:34 -0500 Subject: [PATCH] =?UTF-8?q?fix(theme):=20showcase=20renders=20when=20run?= =?UTF-8?q?=20=E2=80=94=20viewport-fit=20+=20display=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- client/project.godot | 7 +++++++ client/scripts/theme/theme_showcase.gd | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/client/project.godot b/client/project.godot index 9c87665..fc1bef0 100644 --- a/client/project.godot +++ b/client/project.godot @@ -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" diff --git a/client/scripts/theme/theme_showcase.gd b/client/scripts/theme/theme_showcase.gd index 20a0d82..48fe2fb 100644 --- a/client/scripts/theme/theme_showcase.gd +++ b/client/scripts/theme/theme_showcase.gd @@ -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