feat(scoreboard): it ticks — the marquee is the design, not an option

Creator, plainly: "the entire point of a ticker is to tick… so, tick." The static strip was my
reading of an earlier exchange; it is gone.

How it ticks without becoming the compositor's most expensive layer:
- `ScoreboardRenderer.RenderRun` rasterises the run ONCE per value change at its natural width plus
  a gap.
- `ScoreboardPresenter` crops a 1920-wide window at a moving offset each tick — a row-wise byte
  copy, no text layout, no re-raster.
- `TickScoreboard` runs on the existing 30 Hz meter clock and only while the strip is shown, so a
  hidden or disabled scoreboard costs nothing.

The dev simulation uses the same path, so what is previewed is what ships.

Test updated to the real contract: no tick → identical pixels; a tick → different pixels; a value
change → re-rasterised run. (The old test asserted frame-instance identity, which a cropped window
can never satisfy.)
This commit is contained in:
2026-10-30 15:17:55 -07:00
parent 882b8551d9
commit 460b36204d
5 changed files with 141 additions and 14 deletions
+14 -6
View File
@@ -1,3 +1,4 @@
using System.Linq;
using System.Threading;
using Xunit;
using ytLive.Models;
@@ -38,18 +39,25 @@ public class ScoreboardPresenterTests
var first = presenter.Frame;
Assert.NotNull(first);
// No change: the SAME frame instance comes back (cache hit).
Assert.Same(first, presenter.Frame);
// No tick, no change: the same pixels come back (the run is cached).
Assert.Equal(first!.BgraPixels, presenter.Frame!.BgraPixels);
// A visible change: a new frame.
// A TICK moves the window: the pixels must differ.
presenter.Advance(0.5);
var ticked = presenter.Frame;
Assert.NotNull(ticked);
Assert.NotEqual(first.BgraPixels, ticked!.BgraPixels);
// A visible change re-rasterises the run.
recorder.Record(Member("Second"));
var second = presenter.Frame;
Assert.NotNull(second);
Assert.NotSame(first, second);
Assert.NotEqual(ticked.BgraPixels, second!.BgraPixels);
// A gift-recipient event changes nothing displayed, so the raster is reused.
// A gift-recipient event changes nothing displayed: same window, same pixels.
var beforeGift = presenter.Frame!.BgraPixels.ToArray();
recorder.Record(new ChatMessage { Kind = ChatEventKind.GiftReceived, AuthorName = "Recipient" });
Assert.Same(second, presenter.Frame);
Assert.Equal(beforeGift, presenter.Frame!.BgraPixels);
// Disabling every tile returns no frame, and the layer draws nothing.
presenter.SetTiles(ScoreboardTiles.None);