Skip to content

Conversation

@AristurtleDev
Copy link
Collaborator

Description

Implements a copy constructor and Clone() method to enable creating copies of Sprite instances without mutating the original. This addresses the use case of needing multiple sprite instances with different properties (such as SpriteEffects) that share the same texture region.

The implementation performs a shallow copy where the new sprite shares the same TextureRegion reference but has independent copies of all other properties. The Clone() method delegates to the copy constructor.

Related Issues/Tickets

Changes Made

  • Added Sprite(Sprite) copy constructor
  • Added Sprite.Cone() method

Checklist

Please read and check the following items. Pull requests will not be reviewed if all items are not checked.

  • I have verified that there are no existing pull requests that would overlap with this pull request.
  • I have verified that I am following the guidelines as outlined in this project's contribution policy
  • I have verified that this pull request adheres to this project's code of conduct.
  • I have written a descriptive title for this pull request.
  • I have provided appropriate test coverage were applicable.

@AristurtleDev AristurtleDev self-assigned this Nov 2, 2025
@AristurtleDev AristurtleDev added Status: Completed Work finished Type: Enhancement Improvement to existing feature Priority: High Important, should be next Area: API API Platform: Cross-platform All platforms labels Nov 2, 2025
@AristurtleDev AristurtleDev merged commit 76858d8 into develop Nov 2, 2025
1 check passed
@AristurtleDev AristurtleDev deleted the feature/sprite-clone branch November 2, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: API API Platform: Cross-platform All platforms Priority: High Important, should be next Status: Completed Work finished Type: Enhancement Improvement to existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Implement ICloneable interface for Sprite

2 participants