Skip to content

Add FilledStrokedRectangle: flat fill+stroke renderable for FRB's Rectangle codegen - #4342

Merged
vchelaru merged 1 commit into
mainfrom
4341-frb-rectangle-renderable
Aug 5, 2026
Merged

Add FilledStrokedRectangle: flat fill+stroke renderable for FRB's Rectangle codegen#4342
vchelaru merged 1 commit into
mainfrom
4341-frb-rectangle-renderable

Conversation

@vchelaru

@vchelaru vchelaru commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Adds RenderingLibrary.Math.Geometry.FilledStrokedRectangle — a flat IRenderableIpso that draws fill and stroke in one Render() call, gated independently (IsFilled for fill, StrokeWidth > 0 for stroke, neither hides the other). Built for FlatRedBall's Glue codegen, which emits one flat contained field per standard element and can't adopt RectangleRuntime's two-slot GraphicalUiElement composite.

Reuses the existing draw techniques directly — Sprite.Render for fill, LineRectangle.RenderLinePrimitive/UpdateLinePrimitive for stroke (both already static and generic over any IRenderableIpso) — instead of reimplementing either, so a fix to either draw path never needs hand-mirroring into a third place.

RectangleRuntime's XNALIKE two-slot composite is unchanged — it's still needed so the optional MonoGameGumShapes package can swap in richer per-slot renderables (gradient/dropshadow/rounded corners). This new type is scoped to plain square-corner fill + stroke only, matching the issue.

Wiring FRB's StandardsCodeGenerator to actually use this type is tracked separately in the FlatRedBall repo (#1907/#1967).

Test plan

  • New unit tests in MonoGameGum.Tests/RenderingLibraries/Math/Geometry/FilledStrokedRectangleTests.cs (defaults, independent fill/stroke gating, parent/children, alpha)
  • Full MonoGameGum.Tests suite green (2142/2142)
  • KniGum builds clean, no new warnings
  • FRB canary (GumCore.DesktopGlNet6.csproj, net6.0 + net8.0): 0 errors, matches baseline

Manual test: not needed — this is a new, standalone renderable type not wired into any existing runtime path (MonoGameGum's RectangleRuntime is untouched); correctness is covered by unit tests + the FRB canary compile.

Closes #4341

…tangle codegen

FlatRedBall's Glue codegen emits one flat contained field per standard element and
can't adopt RectangleRuntime's two-slot GraphicalUiElement composite. This new
RenderingLibrary type draws fill and stroke in one Render() call, gated
independently (IsFilled for fill, StrokeWidth > 0 for stroke), reusing
Sprite.Render and LineRectangle.RenderLinePrimitive/UpdateLinePrimitive directly
rather than reimplementing either. MonoGameGum's own RectangleRuntime keeps its
existing two-slot composite, which is still needed for the optional
MonoGameGumShapes package's per-slot gradient/dropshadow/rounded-corner support.

Closes #4341

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rectangle standard element: FlatRedBall codegen needs a single-type fill+stroke renderable, not RectangleRuntime's two-slot composite

1 participant