fix(scoreboard): the defaults were never applied — a record struct zero-initialises

Creator's defaults: white text, Background ON (black, 20%), speed capped at 200 px/s, text size shown
in real pixels, and "plate" dropped from the label.

The important find is underneath those: `ScoreboardStyle` is a record STRUCT, and `new
ScoreboardStyle()` zero-initialises — it does NOT run the constructor's parameter defaults. So the
shipped strip had null text colour, NO background and zero opacity, whatever the source said. That is
why the Background checkbox and the opacity slider looked like they had no code behind them: the
renderer was faithfully drawing the zeros it was handed.

An explicit parameterless constructor now carries the real defaults, and the renderer test asserts
them (white / on / black / 0.20 / max speed 200) so this class of silent-zero cannot return.

Readouts fixed too: the opacity and text-size setters never raised their own property, so the numbers
never moved while the render did. Text size now reads "24 px" instead of a bare slider value, and
snaps to whole pixels.
This commit is contained in:
2026-10-30 15:24:14 -07:00
parent 28525c90aa
commit c03acd0aa0
6 changed files with 43 additions and 9 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ public sealed class ScoreboardPresenter
public const double DefaultPixelsPerSecond = 120;
public const double MinPixelsPerSecond = 20;
public const double MaxPixelsPerSecond = 400;
public const double MaxPixelsPerSecond = 200; // creator cap: faster than this is unreadable
/// <summary>Advances the scroll by <paramref name="seconds"/>. The strip is a marquee: one
/// measured run, cropped to a moving window, so a tick is a row-wise byte copy rather than a
+11 -2
View File
@@ -15,9 +15,18 @@ public readonly record struct ScoreboardStyle(
string TextColor = "#FFFFFF",
bool BackgroundEnabled = true,
string BackgroundColor = "#000000",
double BackgroundOpacity = 0.55,
double BackgroundOpacity = 0.20,
double FontSize = ScoreboardLayout.MaxFontSize,
double SeparatorOpacity = 0.45);
double SeparatorOpacity = 0.45)
{
/// <summary>A record STRUCT's implicit parameterless constructor zero-initialises — it does NOT
/// run the parameter defaults. Without this, `new ScoreboardStyle()` produced null text colour,
/// no background and zero opacity: every "default" in this file was a lie, and the plate/opacity
/// controls looked dead because the renderer was faithfully drawing what it was given.</summary>
public ScoreboardStyle() : this("#FFFFFF", true, "#000000", 0.20, ScoreboardLayout.MaxFontSize, 0.45)
{
}
}
/// <summary>Rasterises the scoreboard strip (one line, shrinking/wrapping via
/// <see cref="ScoreboardLayout.FitLine"/>) into a straight-alpha BGRA frame the compositor blits.