1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 05:58:35 +01:00

Compare commits

..

2 commits

3 changed files with 18 additions and 3 deletions

View file

@ -13,6 +13,7 @@ Additions
- Added StringBuilder overloads to GenericFont - Added StringBuilder overloads to GenericFont
- Added ColorExtensions.Multiply - Added ColorExtensions.Multiply
- Added SoundEffectInstanceHandler.Stop - Added SoundEffectInstanceHandler.Stop
- Added TextureRegion.OffsetCopy
Improvements Improvements
- Generify GenericFont's string drawing - Generify GenericFont's string drawing
@ -30,6 +31,10 @@ Improvements
Fixes Fixes
- Fixed paragraph links having incorrect hover locations when using special text alignments - Fixed paragraph links having incorrect hover locations when using special text alignments
### MLEM.Extended
Improvements
- Preserve texture region names when converting between MLEM and MG.Extended
### MLEM.Data ### MLEM.Data
Improvements Improvements
- Rethrow exceptions when no RawContentManager readers could be constructed - Rethrow exceptions when no RawContentManager readers could be constructed

View file

@ -23,7 +23,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="region">The nine patch to convert</param> /// <param name="region">The nine patch to convert</param>
/// <returns>The converted nine patch</returns> /// <returns>The converted nine patch</returns>
public static TextureRegion2D ToExtended(this TextureRegion region) { public static TextureRegion2D ToExtended(this TextureRegion region) {
return new TextureRegion2D(region.Texture, region.U, region.V, region.Width, region.Height); return new TextureRegion2D(region.Name, region.Texture, region.U, region.V, region.Width, region.Height);
} }
/// <summary> /// <summary>
@ -32,7 +32,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="patch">The nine patch to convert</param> /// <param name="patch">The nine patch to convert</param>
/// <returns>The converted nine patch</returns> /// <returns>The converted nine patch</returns>
public static NinePatch ToMlem(this NinePatchRegion2D patch) { public static NinePatch ToMlem(this NinePatchRegion2D patch) {
return new NinePatch(new TextureRegion(patch.Texture, patch.Bounds), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding); return new NinePatch(((TextureRegion2D) patch).ToMlem(), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding);
} }
/// <summary> /// <summary>
@ -41,7 +41,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="region">The nine patch to convert</param> /// <param name="region">The nine patch to convert</param>
/// <returns>The converted nine patch</returns> /// <returns>The converted nine patch</returns>
public static TextureRegion ToMlem(this TextureRegion2D region) { public static TextureRegion ToMlem(this TextureRegion2D region) {
return new TextureRegion(region.Texture, region.Bounds); return new TextureRegion(region.Texture, region.Bounds) {Name = region.Name};
} }
} }

View file

@ -118,6 +118,16 @@ namespace MLEM.Textures {
/// <param name="size">The size of this area</param> /// <param name="size">The size of this area</param>
public TextureRegion(TextureRegion region, Point uv, Point size) : this(region.Texture, region.Position + uv, size) {} 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> /// <summary>