Add FilledStrokedRectangle: flat fill+stroke renderable for FRB's Rectangle codegen - #4342
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
RenderingLibrary.Math.Geometry.FilledStrokedRectangle— a flatIRenderableIpsothat draws fill and stroke in oneRender()call, gated independently (IsFilledfor fill,StrokeWidth > 0for stroke, neither hides the other). Built for FlatRedBall's Glue codegen, which emits one flat contained field per standard element and can't adoptRectangleRuntime's two-slotGraphicalUiElementcomposite.Reuses the existing draw techniques directly —
Sprite.Renderfor fill,LineRectangle.RenderLinePrimitive/UpdateLinePrimitivefor stroke (both already static and generic over anyIRenderableIpso) — 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 optionalMonoGameGumShapespackage 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
StandardsCodeGeneratorto actually use this type is tracked separately in the FlatRedBall repo (#1907/#1967).Test plan
MonoGameGum.Tests/RenderingLibraries/Math/Geometry/FilledStrokedRectangleTests.cs(defaults, independent fill/stroke gating, parent/children, alpha)MonoGameGum.Testssuite green (2142/2142)KniGumbuilds clean, no new warningsGumCore.DesktopGlNet6.csproj, net6.0 + net8.0): 0 errors, matches baselineManual test: not needed — this is a new, standalone renderable type not wired into any existing runtime path (MonoGameGum's
RectangleRuntimeis untouched); correctness is covered by unit tests + the FRB canary compile.Closes #4341