feat(D.2b): controls.ini stylesheet loader + apply title color

Adds ControlsIni — a minimal flat-INI reader for retail's controls.ini
(#AARRGGBB alpha-first color tokens; case-insensitive section/key lookup;
missing file returns an empty sheet with no throw). Wires the [title]
color token into the vitals panel's UiLabel in GameWindow.OnLoad, with
hardcoded white as the fallback. Visually a no-op (retail's [title] color
is white), but proves the stylesheet plumbing end-to-end (D.2b §7).
Three unit tests cover section parsing, #AARRGGBB decode, and graceful
missing-file handling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-14 17:31:55 +02:00
parent b18403da02
commit 97bd1d2f09
3 changed files with 112 additions and 1 deletions

View file

@ -1748,12 +1748,20 @@ public sealed class GameWindow : IDisposable
return (t, w, h);
}
// Phase D.2b — optional retail stylesheet. controls.ini lives under
// the AC install (ACDREAM_AC_DIR); absent → source-verified fallback.
var controls = _options.AcDir is { } acDir
? AcDream.App.UI.ControlsIni.Load(System.IO.Path.Combine(acDir, "controls", "controls.ini"))
: AcDream.App.UI.ControlsIni.Parse(string.Empty);
var titleColor = controls.TryColor("title", "color", out var tc)
? tc : new System.Numerics.Vector4(1f, 1f, 1f, 1f);
var panel = new AcDream.App.UI.UiNineSlicePanel(ResolveChrome)
{ Left = 10, Top = 30, Width = 220, Height = 96 };
panel.AddChild(new AcDream.App.UI.UiLabel
{
Text = "Vitals", Left = 8, Top = 4,
TextColor = new System.Numerics.Vector4(1f, 1f, 1f, 1f),
TextColor = titleColor,
});
var vm = _vitalsVm!;