mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-10-31 21:00:51 +01:00
Added TextureRegion.OffsetCopy
This commit is contained in:
parent
9ccb3536a0
commit
3edd593886
2 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue