Files
code_of_conquest_dnd/client/scripts/theme/theme_showcase.gd
Phillip Tarrant 0082765ee7 fix(theme): showcase renders every §6 element (3rd surface, 3 variations, all fonts, labelled swatches)
- _surfaces(): add VignetteOverlay.tscn alongside ParchmentPanel/DarkBay,
  backed by a Palette.STEEL ColorRect so the dim is visibly rendering.
- _variations(): add ItemTileEmpty (next to filled ItemTile), ParchmentInset,
  and DarkPanel stylebox nodes.
- _fonts(): new section rendering default serif body, Accent
  (Architects Daughter), and Mono (JetBrains Mono) labels at real sizes.
- _swatches(): wrap each ColorRect in a VBoxContainer with a Mono caption
  Label naming its Palette const, per spec's "labelled swatches."

No raw hex / Color(...) literals introduced; all colour via Palette.*, all
styleboxes via ThemeKeys.* variation names.
2026-07-10 20:46:25 -05:00

168 lines
5.4 KiB
GDScript

# client/scripts/theme/theme_showcase.gd
extends Control
## The eyeball proof for the shared Theme (spec §7). Builds every token, stylebox,
## font, surface, and bar on one scrollable screen. No AI, no state. §2: presentation.
const Palette = preload("res://scripts/theme/palette.gd")
const ThemeKeys = preload("res://scripts/theme/theme_keys.gd")
const GAME_THEME := "res://assets/theme/game_theme.tres"
func _ready() -> void:
theme = load(GAME_THEME)
set_anchors_preset(Control.PRESET_FULL_RECT)
var scroll := ScrollContainer.new()
scroll.set_anchors_preset(Control.PRESET_FULL_RECT)
add_child(scroll)
var col := VBoxContainer.new()
col.custom_minimum_size = Vector2(1900, 0)
col.add_theme_constant_override("separation", 16)
scroll.add_child(col)
col.add_child(_heading("SHARED THEME — SHOWCASE"))
col.add_child(_swatches())
col.add_child(_variations())
col.add_child(_fonts())
col.add_child(_rarity())
col.add_child(_bars())
col.add_child(_surfaces())
func _heading(text: String) -> Label:
var l := Label.new()
l.text = text
l.theme_type_variation = &"Heading"
return l
func _swatches() -> Control:
var grid := GridContainer.new()
grid.columns = 8
var tokens := [
["STAGE_1", Palette.STAGE_1], ["BAY_STRIPE_A", Palette.BAY_STRIPE_A],
["DARK_PANEL_70", Palette.DARK_PANEL_70], ["SHEET_TOP", Palette.SHEET_TOP],
["PARCHMENT_CARD", Palette.PARCHMENT_CARD], ["BLOOD", Palette.BLOOD],
["GOLD", Palette.GOLD], ["STEEL", Palette.STEEL], ["GREEN", Palette.GREEN],
["INK_BODY", Palette.INK_BODY], ["CREAM", Palette.CREAM],
]
for entry in tokens:
var col := VBoxContainer.new()
var r := ColorRect.new()
r.color = entry[1]
r.custom_minimum_size = Vector2(120, 60)
col.add_child(r)
var caption := Label.new()
caption.text = entry[0]
caption.theme_type_variation = &"Mono"
col.add_child(caption)
grid.add_child(col)
return grid
func _variations() -> Control:
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 12)
var cta := Button.new(); cta.text = "ENTER THE WORLD"; cta.theme_type_variation = ThemeKeys.PRIMARY_CTA
var tab := Button.new(); tab.text = "INACTIVE"; tab.theme_type_variation = ThemeKeys.TAB
var tab_a := Button.new(); tab_a.text = "ACTIVE"; tab_a.theme_type_variation = ThemeKeys.TAB_ACTIVE
var chip := Button.new(); chip.text = "INTIMIDATE · STR"; chip.theme_type_variation = ThemeKeys.CHIP
for b in [cta, tab, tab_a, chip]:
row.add_child(b)
var card := PanelContainer.new(); card.theme_type_variation = ThemeKeys.PARCHMENT_CARD
card.custom_minimum_size = Vector2(160, 80)
row.add_child(card)
# Filled vs empty item tile, side by side for comparison.
var tile_filled := PanelContainer.new()
tile_filled.theme_type_variation = ThemeKeys.ITEM_TILE
tile_filled.custom_minimum_size = Vector2(64, 64)
row.add_child(tile_filled)
var tile_empty := PanelContainer.new()
tile_empty.theme_type_variation = ThemeKeys.ITEM_TILE_EMPTY
tile_empty.custom_minimum_size = Vector2(64, 64)
row.add_child(tile_empty)
var inset := PanelContainer.new()
inset.theme_type_variation = ThemeKeys.PARCHMENT_INSET
inset.custom_minimum_size = Vector2(160, 80)
row.add_child(inset)
var dark := PanelContainer.new()
dark.theme_type_variation = ThemeKeys.DARK_PANEL
dark.custom_minimum_size = Vector2(160, 80)
row.add_child(dark)
return row
func _fonts() -> Control:
# All three bundled font families, at their real Theme sizes, plus the
# default serif body face (not otherwise shown elsewhere on this screen).
var col := VBoxContainer.new()
col.add_theme_constant_override("separation", 6)
var body := Label.new()
body.text = "The road to the Ashmarch is longer than the maps admit."
col.add_child(body)
var accent := Label.new()
accent.text = "Vexcca of the Ashmarch"
accent.theme_type_variation = &"Accent"
col.add_child(accent)
var mono := Label.new()
mono.text = "STR 14 · INITIATIVE +2 · AC 16"
mono.theme_type_variation = &"Mono"
col.add_child(mono)
return col
func _rarity() -> Control:
var row := HBoxContainer.new()
for i in range(5):
var tile := PanelContainer.new()
tile.theme_type_variation = ThemeKeys.ITEM_TILE
tile.custom_minimum_size = Vector2(72, 72)
var bar := ColorRect.new()
bar.color = Palette.rarity_color(i)
bar.custom_minimum_size = Vector2(60, 4)
tile.add_child(bar)
row.add_child(tile)
return row
func _bars() -> Control:
var row := HBoxContainer.new()
for kind in [&"hp", &"mp", &"stamina"]:
var pair = Palette.stat_bar(kind)
var bar := ColorRect.new()
bar.color = pair[0]
bar.custom_minimum_size = Vector2(200, 18)
row.add_child(bar)
return row
func _surfaces() -> Control:
var row := HBoxContainer.new()
row.custom_minimum_size = Vector2(0, 240)
for path in ["res://scenes/theme/surfaces/ParchmentPanel.tscn",
"res://scenes/theme/surfaces/DarkBay.tscn"]:
var s = load(path).instantiate()
s.custom_minimum_size = Vector2(600, 220)
row.add_child(s)
# VignetteOverlay draws a black-with-alpha dim; give it a mid-tone backing
# so the dim is visibly rendering rather than reading as empty space.
var vignette_slot := Control.new()
vignette_slot.custom_minimum_size = Vector2(600, 220)
var backing := ColorRect.new()
backing.color = Palette.STEEL
backing.set_anchors_preset(Control.PRESET_FULL_RECT)
vignette_slot.add_child(backing)
var vignette = load("res://scenes/theme/surfaces/VignetteOverlay.tscn").instantiate()
vignette.set_anchors_preset(Control.PRESET_FULL_RECT)
vignette_slot.add_child(vignette)
row.add_child(vignette_slot)
return row