Keep presentation alive across levels and scale UI for widescreen

This commit is contained in:
UnixNight committed 2026-10-25 03:14:04 -04:00
1 parent 113e9a41cc
commit 69d0187a21
26 files changed
+889 -70

No files matched your search

+21
View File
@@ -50,6 +50,27 @@ try
Check(final.Draws.Skip(1).All(d => !d.Visible), "Timed-out objective has no remaining overlay draw");
panel.Key(true); panel.Step(1); PresentPanel();
Check(final.Draws.Skip(1).Count(d => d.Visible) == 3, "O reopens timed-out panel through the timer");
foreach (var (width, height) in new[] { (1920u, 1080u), (3440u, 1440u), (3840u, 1080u), (1080u, 1920u) })
{
hud.Update(final, 1, true, true, viewportWidth: width, viewportHeight: height);
var viewport = new UiViewport(width, height);
Vector2 Pixel(int index)
{
var p = final.Vertices[index].Position;
return new((p.X + 1) * width / 2, (p.Y + 1) * height / 2);
}
var pad = Pixel(1); var modal = Pixel(29);
Check(Vector2.Distance(pad, new(width - 256 * viewport.Scale, height - 169 * viewport.Scale)) < .003f,
"Objective pad remains bottom/right anchored");
var modalExpected = (new Vector2(210, 210) + viewport.CenterOffset) * viewport.Scale;
Check(Vector2.Distance(modal, modalExpected) < .003f, "Modal shifts with centered authored canvas");
Check(MathF.Abs((Pixel(30).X - modal.X) / 207 - (Pixel(32).Y - modal.Y) / 100) < .0001f,
"Original modal art has equal physical X/Y scale");
Check(MathF.Abs((Pixel(2).X - pad.X) / 320 - (Pixel(4).Y - pad.Y) / 173) < .0001f,
"Objective pad is never stretched in widescreen");
}
hud.Update(final, 2, true, true);
Near(final.Vertices[1].Position, new(.2f, 2*311f/480-1, 0), "Returning to4:3 restores source positions");
Reject(() => hud.Update(source, 1, true, false), "Missing final ranges");
Reject(() => hud.Update(final, 1, true, false, float.NaN), "Nonfinite HUD offset");
File.WriteAllText(path, Manifest(entries.Select(e => new { e.id, width=e.id==120 ? 0 : e.width, e.height, e.path })));