1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 01:39:23 +01:00

Added TextureRegion.OffsetCopy

This commit is contained in:
Ell 2022-01-22 16:51:42 +01:00
parent 9ccb3536a0
commit 3edd593886
2 changed files with 11 additions and 0 deletions

View file

@ -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

View file

@ -118,6 +118,16 @@ namespace MLEM.Textures {
/// <param name="size">The size of this area</param>
public TextureRegion(TextureRegion region, Point uv, Point size) : this(region.Texture, region.Position + uv, size) {}
/// <summary>
/// Returns a new <see cref="TextureRegion"/> that has the same <see cref="Texture"/>, <see cref="Pivot"/> and <see cref="Size"/> as this texture, but the returned region's <see cref="Position"/> will be offset by <paramref name="offset"/>.
/// Note that the <see cref="Name"/> is not preserved in the copy.
/// </summary>
/// <param name="offset">The offset to apply to the <see cref="Position"/></param>
/// <returns>An offset copy of this texture region</returns>
public TextureRegion OffsetCopy(Point offset) {
return new TextureRegion(this.Texture, this.Position + offset, this.Size) {Pivot = this.Pivot};
}
}
/// <summary>