Skip to content

Add SpriteBatch Draw/DrawString overloads accepting Pose2 - #2609

Draft
nkast with Copilot wants to merge 1 commit into
mainfrom
copilot/add-spritebatch-overloads-pose2
Draft

Add SpriteBatch Draw/DrawString overloads accepting Pose2#2609
nkast with Copilot wants to merge 1 commit into
mainfrom
copilot/add-spritebatch-overloads-pose2

Conversation

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

SpriteBatch had no overloads accepting Pose2, requiring callers to manually decompose it into position + rotation at every call site.

Changes

  • SpriteBatch.Draw — new overload replacing Vector2 position + Complex rotation with a single Pose2 pose:
    Draw(Texture2D texture, Pose2 pose, Rectangle? sourceRectangle, Color color,
         Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth)
  • SpriteBatch.DrawString — three new overloads (mirroring existing Complex variants) for string, StringBuilder, and StringBuilder + RTL:
    DrawString(SpriteFont font, string text,        Pose2 pose, Color color, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth)
    DrawString(SpriteFont font, StringBuilder text, Pose2 pose, Color color, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth)
    DrawString(SpriteFont font, StringBuilder text, Pose2 pose, Color color, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth, bool rtl)

All overloads delegate to their corresponding Complex counterparts via pose.Translation and pose.Orientation.

@nkast

nkast commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

I don't know if that would be helpful or add more noise to Spritebatch. It was more of a test to see what Claude could do.

@nkast

nkast commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

@copilot do you think we need all of those?

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot do you think we need all of those?

Not strictly — here's the breakdown by value:

  • Draw(texture, Pose2, …) — Most useful. Sprites are the primary SpriteBatch use case, and Pose2 (position + orientation) maps directly onto what a sprite's world transform is. Worth keeping.
  • DrawString(…, string text, Pose2, …) — Useful in roughly the same scenarios as the Draw one (placing text at an oriented world position). Reasonable to keep.
  • DrawString(…, StringBuilder text, Pose2, …) — Mirrors the string variant. StringBuilder overloads are present throughout the API, so this exists purely for completeness/symmetry. Lower priority.
  • DrawString(…, StringBuilder text, Pose2, …, bool rtl) — The rtl flag is niche, and pairing it with StringBuilder + Pose2 is the most obscure combination. Most candidates for removal if you want to reduce noise.

If the goal is minimal added surface, keeping just the first two (Draw + DrawString(string)) would cover the practical cases and I can drop the StringBuilder pair.

Copilot AI requested a review from nkast April 24, 2026 18:52
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.

2 participants