diff --git a/CHANGELOG.md b/CHANGELOG.md index c3628c9..474d8af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Additions - Added StringBuilder overloads to GenericFont - Added ColorExtensions.Multiply - Added SoundEffectInstanceHandler.Stop +- Added TextureRegion.OffsetCopy Improvements - Generify GenericFont's string drawing diff --git a/MLEM/Textures/TextureRegion.cs b/MLEM/Textures/TextureRegion.cs index ab9f875..f87e8df 100644 --- a/MLEM/Textures/TextureRegion.cs +++ b/MLEM/Textures/TextureRegion.cs @@ -118,6 +118,16 @@ namespace MLEM.Textures { /// The size of this area public TextureRegion(TextureRegion region, Point uv, Point size) : this(region.Texture, region.Position + uv, size) {} + /// + /// Returns a new that has the same , and as this texture, but the returned region's will be offset by . + /// Note that the is not preserved in the copy. + /// + /// The offset to apply to the + /// An offset copy of this texture region + public TextureRegion OffsetCopy(Point offset) { + return new TextureRegion(this.Texture, this.Position + offset, this.Size) {Pivot = this.Pivot}; + } + } ///