1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-09-08 01:32:08 +02:00

Moved extension methods into matching namespaces to avoid unexpected suggestions

This commit is contained in:
Ell 2024-07-19 20:02:28 +02:00
parent 13436a31ea
commit 677230ce28
85 changed files with 130 additions and 142 deletions

View file

@ -24,6 +24,7 @@ Additions
Improvements
- **Made the Keybind.Combinations collection a public property**
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
- Allow NumberExtensions.GetPoints to include bottom and right coordinates
- Allow AutoTiling overlayTextures to return null texture regions
@ -56,9 +57,13 @@ Removals
### MLEM.Extended
Improvements
- **Added compatibility for MonoGame.Extended 4.0.0**
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
- Added compatibility for FNA.Extended
### MLEM.Data
Improvements
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
Removals
- **Removed obsolete types DynamicEnumConverter, CopyExtensions, DynamicEnum, NetBufferSerializer, and NetExtensions**

View file

@ -5,7 +5,7 @@ using Android.OS;
using Android.Views;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Misc;
using Uri = Android.Net.Uri;

View file

@ -2,7 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Animations;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Textures;
using MLEM.Ui;

View file

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Textures;

View file

@ -2,8 +2,8 @@ using System.Linq;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Ui;
using MLEM.Ui.Elements;

View file

@ -4,8 +4,8 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Pathfinding;
using MLEM.Startup;
using MLEM.Ui;

View file

@ -2,11 +2,11 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Formatting;
using MLEM.Formatting.Codes;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Textures;

View file

@ -5,11 +5,10 @@ using System.Linq;
using Coroutine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Formatting;
using MLEM.Input;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Textures;
using MLEM.Ui;

View file

@ -5,7 +5,7 @@ using Microsoft.Xna.Framework.Content;
using MLEM.Data.Json;
using Newtonsoft.Json;
namespace MLEM.Data {
namespace MLEM.Data.Content {
/// <summary>
/// A set of extensions for dealing with <see cref="ContentManager"/>
/// </summary>

View file

@ -1,7 +1,7 @@
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Textures;
namespace MLEM.Data.Content {
/// <inheritdoc />

View file

@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Textures;

View file

@ -1,5 +1,5 @@
using System;
using MLEM.Misc;
using MLEM.Maths;
using Newtonsoft.Json;
namespace MLEM.Data.Json {

View file

@ -1,5 +1,3 @@
using System;
using System.Linq;
using Newtonsoft.Json;
namespace MLEM.Data.Json {

View file

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using MLEM.Misc;
using Newtonsoft.Json;

View file

@ -1,6 +1,6 @@
using System;
using System.Globalization;
using MLEM.Misc;
using MLEM.Maths;
using Newtonsoft.Json;
namespace MLEM.Data.Json {

View file

@ -4,9 +4,9 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Maths;
using MLEM.Textures;
using static MLEM.Extensions.TextureExtensions;
using static MLEM.Textures.TextureExtensions;
namespace MLEM.Data {
/// <summary>

View file

@ -1,10 +1,12 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Extended.Maths;
using MLEM.Graphics;
using MLEM.Maths;
using ShapeExtensions = MonoGame.Extended.ShapeExtensions;
using RectangleF = MonoGame.Extended.RectangleF;
namespace MLEM.Extended.Extensions {
namespace MLEM.Extended.Graphics {
/// <summary>
/// A set of extension methods for dealing with <see cref="SpriteBatch"/> and <see cref="RectangleF"/> in combination.
/// </summary>

View file

@ -1,10 +1,10 @@
using MLEM.Extensions;
using MLEM.Maths;
using MLEM.Textures;
using MonoGame.Extended.Graphics;
using NinePatch = MLEM.Textures.NinePatch;
using ExtNinePatch = MonoGame.Extended.Graphics.NinePatch;
namespace MLEM.Extended.Extensions {
namespace MLEM.Extended.Graphics {
/// <summary>
/// A set of extensions for converting texture-related types between MLEM and MonoGame.Extended.
/// </summary>

View file

@ -37,7 +37,10 @@
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
<Compile Remove="Tiled/**" />
<Compile Remove="Extensions/**" />
<Compile Remove="Graphics/SpriteBatchExtensions.cs" />
<Compile Remove="Graphics/TextureExtensions.cs" />
<Compile Remove="Maths/NumberExtensions.cs" />
<Compile Remove="Maths/RandomExtensions.cs" />
<Compile Remove="Font/GenericBitmapFont.cs" />
</ItemGroup>

View file

@ -34,7 +34,10 @@
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
<Compile Remove="Tiled/**" />
<Compile Remove="Extensions/**" />
<Compile Remove="Graphics/SpriteBatchExtensions.cs" />
<Compile Remove="Graphics/TextureExtensions.cs" />
<Compile Remove="Maths/NumberExtensions.cs" />
<Compile Remove="Maths/RandomExtensions.cs" />
<Compile Remove="Font/GenericBitmapFont.cs" />
</ItemGroup>

View file

@ -1,29 +1,31 @@
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MLEM.Maths;
using MonoGame.Extended;
using MlemRectangleF = MLEM.Maths.RectangleF;
using ExtRectangleF = MonoGame.Extended.RectangleF;
namespace MLEM.Extended.Extensions {
namespace MLEM.Extended.Maths {
/// <summary>
/// A set of extension methods that convert MLEM types to MonoGame.Extended types and vice versa.
/// </summary>
public static class NumberExtensions {
/// <summary>
/// Converts a MLEM <see cref="Misc.RectangleF"/> to a MonoGame.Extended <see cref="RectangleF"/>.
/// Converts a MLEM <see cref="MlemRectangleF"/> to a MonoGame.Extended <see cref="ExtRectangleF"/>.
/// </summary>
/// <param name="rect">The rectangle to convert</param>
/// <returns>The converted rectangle</returns>
public static RectangleF ToExtended(this Misc.RectangleF rect) {
return new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
public static ExtRectangleF ToExtended(this MlemRectangleF rect) {
return new ExtRectangleF(rect.X, rect.Y, rect.Width, rect.Height);
}
/// <summary>
/// Converts a MonoGame.Extended <see cref="RectangleF"/> to a MLEM <see cref="Misc.RectangleF"/>.
/// Converts a MonoGame.Extended <see cref="ExtRectangleF"/> to a MLEM <see cref="MlemRectangleF"/>.
/// </summary>
/// <param name="rect">The rectangle to convert</param>
/// <returns>The converted rectangle</returns>
public static Misc.RectangleF ToMlem(this RectangleF rect) {
return new Misc.RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
public static MlemRectangleF ToMlem(this ExtRectangleF rect) {
return new MlemRectangleF(rect.X, rect.Y, rect.Width, rect.Height);
}
/// <summary>
@ -36,7 +38,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="normal">The direction that the penetration occured in</param>
/// <param name="penetration">The amount that the penetration occured by, in the direction of <paramref name="normal"/></param>
/// <returns>Whether or not a penetration occured</returns>
public static bool Penetrate(this RectangleF rect, RectangleF other, out Vector2 normal, out float penetration) {
public static bool Penetrate(this ExtRectangleF rect, ExtRectangleF other, out Vector2 normal, out float penetration) {
return rect.ToMlem().Penetrate(other.ToMlem(), out normal, out penetration);
}

View file

@ -2,7 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using MonoGame.Extended;
namespace MLEM.Extended.Extensions {
namespace MLEM.Extended.Maths {
/// <summary>
/// A set of extension methods for dealing with <see cref="Random"/>
/// </summary>

View file

@ -3,8 +3,8 @@ using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Cameras;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Misc;
using MonoGame.Extended.Tiled;
using RectangleF = MonoGame.Extended.RectangleF;

View file

@ -5,7 +5,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended;
using MonoGame.Extended.Tiled;
using ColorHelper = MLEM.Extensions.ColorHelper;
using ColorHelper = MLEM.Graphics.ColorHelper;
namespace MLEM.Extended.Tiled {
/// <summary>

View file

@ -2,8 +2,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Extended.Extensions;
using MLEM.Extensions;
using MLEM.Extended.Maths;
using MLEM.Maths;
using MLEM.Misc;
using MonoGame.Extended.Tiled;
using RectangleF = MonoGame.Extended.RectangleF;
@ -125,7 +125,7 @@ namespace MLEM.Extended.Tiled {
/// <summary>
/// Returns an enumerable of normals and penetration amounts for each <see cref="TileCollisionInfo"/> that intersects with the given <see cref="RectangleF"/> area.
/// The normals and penetration amounts are based on <see cref="MLEM.Extensions.NumberExtensions.Penetrate"/>.
/// The normals and penetration amounts are based on <see cref="MLEM.Maths.NumberExtensions.Penetrate"/>.
/// Note that all x penetrations are returned before all y penetrations, which improves collision detection in sidescrolling games with gravity. Note that this behavior can be inverted using <paramref name="prioritizeX"/>.
/// </summary>
/// <param name="getArea">The area to penetrate</param>

View file

@ -2,7 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;

View file

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;

View file

@ -1,6 +1,6 @@
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Misc;
using MLEM.Maths;
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -6,9 +6,9 @@ using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Input;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Sound;
using MLEM.Textures;

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Input;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Textures;

View file

@ -2,12 +2,9 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;
#if FNA
using MLEM.Extensions;
#endif
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -3,9 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;

View file

@ -2,11 +2,11 @@ using System;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Formatting;
using MLEM.Formatting.Codes;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Ui.Style;

View file

@ -1,9 +1,8 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;

View file

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Maths;
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -5,12 +5,9 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using MLEM.Graphics;
using MLEM.Input;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
using MLEM.Ui.Style;
#if FNA
using MLEM.Extensions;
#endif
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -1,5 +1,5 @@
using Microsoft.Xna.Framework;
using MLEM.Misc;
using MLEM.Maths;
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -1,8 +1,7 @@
using System;
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MLEM.Misc;
using MLEM.Maths;
namespace MLEM.Ui.Elements {
/// <summary>

View file

@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Input;
using MLEM.Font;
using MLEM.Graphics;
using MLEM.Input;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Textures;
using MLEM.Ui.Style;

View file

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using Microsoft.Xna.Framework;
using MLEM.Input;
using MLEM.Ui.Style;
using Color = Microsoft.Xna.Framework.Color;
using RectangleF = MLEM.Misc.RectangleF;
using RectangleF = MLEM.Maths.RectangleF;
#if FNA
using MLEM.Extensions;
using MLEM.Maths;
#endif
namespace MLEM.Ui.Elements {

View file

@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using MLEM.Font;
using MLEM.Formatting;
using MLEM.Formatting.Codes;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Sound;
using MLEM.Textures;

View file

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
namespace MLEM.Ui.Style {
/// <summary>

View file

@ -5,12 +5,12 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using MLEM.Input;
using MLEM.Maths;
using MLEM.Misc;
using MLEM.Ui.Elements;
using MLEM.Ui.Style;
#if NET452
using MLEM.Extensions;
#endif
namespace MLEM.Ui {

View file

@ -1,8 +1,7 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Misc;
using MLEM.Maths;
namespace MLEM.Cameras {
/// <summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;

View file

@ -2,9 +2,9 @@ using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Animations;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Textures;
namespace MLEM.Formatting.Codes {

View file

@ -1,10 +1,9 @@
using System;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
namespace MLEM.Formatting.Codes {
/// <inheritdoc />

View file

@ -1,8 +1,8 @@
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Graphics;
namespace MLEM.Formatting.Codes {
/// <inheritdoc />

View file

@ -1,9 +1,9 @@
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Misc;
using MLEM.Graphics;
using MLEM.Maths;
namespace MLEM.Formatting.Codes {
/// <inheritdoc />

View file

@ -4,9 +4,9 @@ using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Formatting.Codes;
using MLEM.Graphics;
using MLEM.Misc;
namespace MLEM.Formatting {

View file

@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Font;
using MLEM.Formatting.Codes;
using MLEM.Maths;
using MLEM.Misc;
namespace MLEM.Formatting {

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,6 +5,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Font;
using MLEM.Formatting.Codes;
using MLEM.Maths;
using MLEM.Misc;
namespace MLEM.Formatting {

View file

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
namespace MLEM.Graphics {
@ -128,7 +128,7 @@ namespace MLEM.Graphics {
AutoTiling.DrawExtendedAutoTileCorner(batch, pos, overlayTextures, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od);
}
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,MLEM.Misc.Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
public static void DrawExtendedAutoTileCorner(SpriteBatch batch, Vector2 pos, Func<int, TextureRegion> overlayTextures, ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0) {
var src = AutoTiling.CalculateExtendedAutoTileOffset(connectsTo, corner);
if (src >= 0) {
@ -151,7 +151,7 @@ namespace MLEM.Graphics {
AutoTiling.AddExtendedAutoTileCorner(batch, pos, overlayTexture, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od, items);
}
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,MLEM.Misc.Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
public static void AddExtendedAutoTileCorner(StaticSpriteBatch batch, Vector2 pos, TextureRegion overlayTexture, ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, ICollection<StaticSpriteBatch.Item> items = null) {
var src = AutoTiling.CalculateExtendedAutoTile(overlayTexture.Area, connectsTo, corner);
if (src != Rectangle.Empty) {
@ -173,7 +173,7 @@ namespace MLEM.Graphics {
AutoTiling.AddExtendedAutoTileCorner(batch, pos, overlayTextures, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od, items);
}
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,MLEM.Misc.Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
/// <inheritdoc cref="DrawExtendedAutoTileCorner(Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,MLEM.Textures.TextureRegion,MLEM.Graphics.AutoTiling.ConnectsTo,Microsoft.Xna.Framework.Color,Direction2,System.Nullable{Microsoft.Xna.Framework.Vector2},System.Nullable{Microsoft.Xna.Framework.Vector2},float)"/>
public static void AddExtendedAutoTileCorner(StaticSpriteBatch batch, Vector2 pos, Func<int, TextureRegion> overlayTextures, ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, ICollection<StaticSpriteBatch.Item> items = null) {
var src = AutoTiling.CalculateExtendedAutoTileOffset(connectsTo, corner);
if (src >= 0) {

View file

@ -2,7 +2,7 @@ using System;
using System.Globalization;
using Microsoft.Xna.Framework;
namespace MLEM.Extensions {
namespace MLEM.Graphics {
/// <summary>
/// A set of extensions for dealing with <see cref="Color"/> objects.
/// </summary>

View file

@ -2,7 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.Extensions {
namespace MLEM.Graphics {
/// <summary>
/// A set of extensions for dealing with <see cref="GraphicsDevice"/> and <see cref="GraphicsDeviceManager"/>
/// </summary>

View file

@ -1,10 +1,9 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Graphics;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Textures;
namespace MLEM.Extensions {
namespace MLEM.Graphics {
/// <summary>
/// A set of extensions for dealing with <see cref="SpriteBatch"/>
/// </summary>

View file

@ -4,7 +4,7 @@ using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#if FNA
using MLEM.Extensions;
using MLEM.Maths;
using System.IO;
#endif

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
#if NET452
using MLEM.Extensions;
using MLEM.Misc;
#endif
namespace MLEM.Input {

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Input;

View file

@ -5,8 +5,9 @@ using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Misc;
namespace MLEM.Input {

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// An enum that represents two-dimensional directions.
/// Both straight and diagonal directions are supported.

View file

@ -1,7 +1,7 @@
using System;
using Microsoft.Xna.Framework;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// This class contains a set of easing functions, adapted from https://easings.net.
/// These can be used for ui elements or any other kind of animations.
@ -11,12 +11,12 @@ namespace MLEM.Misc {
/// <summary>
/// An easing function that constantly returns 0, regardless of the input percentage.
/// This is useful for chaining using <see cref="AndThen(MLEM.Misc.Easings.Easing,MLEM.Misc.Easings.Easing)"/>.
/// This is useful for chaining using <see cref="AndThen(MLEM.Maths.Easings.Easing,MLEM.Maths.Easings.Easing)"/>.
/// </summary>
public static readonly Easing Zero = p => 0;
/// <summary>
/// An easing function that constantly returns 1, regardless of the input percentage.
/// This is useful for chaining using <see cref="AndThen(MLEM.Misc.Easings.Easing,MLEM.Misc.Easings.Easing)"/>.
/// This is useful for chaining using <see cref="AndThen(MLEM.Maths.Easings.Easing,MLEM.Maths.Easings.Easing)"/>.
/// </summary>
public static readonly Easing One = p => 1;
/// <summary>
@ -160,7 +160,7 @@ namespace MLEM.Misc {
/// <summary>
/// Causes the easing function to play fully, followed by <paramref name="other"/> playing fully, in the span between an input of 0 and 1.
/// Note that <see cref="AndThen(MLEM.Misc.Easings.Easing,MLEM.Misc.Easings.Easing[])"/> provides a version of this method for any amount of follow-up easing functions.
/// Note that <see cref="AndThen(MLEM.Maths.Easings.Easing,MLEM.Maths.Easings.Easing[])"/> provides a version of this method for any amount of follow-up easing functions.
/// </summary>
/// <param name="easing">The first easing function to play.</param>
/// <param name="other">The second easing function to play.</param>
@ -171,7 +171,7 @@ namespace MLEM.Misc {
/// <summary>
/// Causes the easing function to play fully, followed by all elements of <paramref name="others"/> playing fully, in the span between an input of 0 and 1.
/// This is an any-amount version of <see cref="AndThen(MLEM.Misc.Easings.Easing,MLEM.Misc.Easings.Easing)"/>.
/// This is an any-amount version of <see cref="AndThen(MLEM.Maths.Easings.Easing,MLEM.Maths.Easings.Easing)"/>.
/// </summary>
/// <param name="easing">The first easing function to play.</param>
/// <param name="others">The next easing functions to play.</param>

View file

@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using MLEM.Misc;
namespace MLEM.Extensions {
namespace MLEM.Maths {
/// <summary>
/// A set of extensions for dealing with <see cref="float"/>, <see cref="Vector2"/>, <see cref="Vector3"/>, <see cref="Vector4"/>, <see cref="Point"/>, <see cref="Matrix"/>, <see cref="Rectangle"/> and <see cref="RectangleF"/>
/// </summary>

View file

@ -2,7 +2,7 @@ using System;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// Represents a generic padding.
/// A padding is an object of data that stores an offset from each side of a rectangle or square.

View file

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace MLEM.Extensions {
namespace MLEM.Maths {
/// <summary>
/// A set of extensions for dealing with <see cref="Random"/>
/// </summary>

View file

@ -1,9 +1,8 @@
using System;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
using MLEM.Extensions;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// Represents a float-based version of <see cref="Rectangle"/>
/// </summary>

View file

@ -1,6 +1,6 @@
using System;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// A seed source contains an <see cref="int"/> value which can be used as a seed for a <see cref="System.Random"/> or <see cref="SingleRandom"/>. Seed sources feature a convenient way to add multiple seeds using <see cref="Add(int)"/>, which will be sufficiently scrambled to be deterministically pseudorandom and combined into a single <see cref="int"/>.
/// This struct behaves similarly to <c>System.HashCode</c> in many ways, with an important distinction being that <see cref="SeedSource"/>'s scrambling procedure is not considered an implementation detail, and will stay consistent between process executions.

View file

@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using MLEM.Extensions;
namespace MLEM.Misc {
namespace MLEM.Maths {
/// <summary>
/// The SingleRandom class allows generating single, one-off pseudorandom numbers based on a seed or a <see cref="SeedSource"/>.
/// The types of numbers that can be generated are <see cref="int"/> and <see cref="float"/>, both of which can be generated with specific minimum and maximum values if desired.
@ -167,7 +166,7 @@ namespace MLEM.Misc {
return RandomExtensions.GetRandomWeightedEntry(entries, weightFunc, SingleRandom.Single(source));
}
/// <inheritdoc cref="GetRandomWeightedEntry{T}(System.Collections.Generic.ICollection{T},System.Func{T,int},MLEM.Misc.SeedSource)"/>
/// <inheritdoc cref="GetRandomWeightedEntry{T}(System.Collections.Generic.ICollection{T},System.Func{T,int},MLEM.Maths.SeedSource)"/>
public static T GetRandomWeightedEntry<T>(ICollection<T> entries, Func<T, float> weightFunc, SeedSource source) {
return RandomExtensions.GetRandomWeightedEntry(entries, weightFunc, SingleRandom.Single(source));
}

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
namespace MLEM.Extensions {
namespace MLEM.Misc {
/// <summary>
/// A set of extensions for dealing with collections of various kinds
/// </summary>

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
namespace MLEM.Misc {

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using MLEM.Misc;
using MLEM.Maths;
namespace MLEM.Pathfinding {
/// <summary>

View file

@ -1,6 +1,5 @@
using System;
using Microsoft.Xna.Framework.Audio;
using MLEM.Extensions;
namespace MLEM.Sound {
/// <summary>

View file

@ -1,6 +1,6 @@
using Microsoft.Xna.Framework.Audio;
namespace MLEM.Extensions {
namespace MLEM.Sound {
/// <summary>
/// A set of extensions for dealing with <see cref="SoundEffect"/> and <see cref="SoundEffectInstance"/>
/// </summary>

View file

@ -1,7 +1,8 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Misc;
namespace MLEM.Textures {
@ -173,17 +174,17 @@ namespace MLEM.Textures {
}
}
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,MLEM.Misc.RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
public static void Draw(this SpriteBatch batch, NinePatch texture, Rectangle destinationRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth, float patchScale = 1) {
batch.Draw(texture, (RectangleF) destinationRectangle, color, rotation, origin, effects, layerDepth, patchScale);
}
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,MLEM.Misc.RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
public static void Draw(this SpriteBatch batch, NinePatch texture, RectangleF destinationRectangle, Color color, float patchScale = 1) {
batch.Draw(texture, destinationRectangle, color, 0, Vector2.Zero, SpriteEffects.None, 0, patchScale);
}
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,MLEM.Misc.RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
/// <inheritdoc cref="Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch,MLEM.Textures.NinePatch,RectangleF,Microsoft.Xna.Framework.Color,float,Microsoft.Xna.Framework.Vector2,Microsoft.Xna.Framework.Graphics.SpriteEffects,float,float)"/>
public static void Draw(this SpriteBatch batch, NinePatch texture, Rectangle destinationRectangle, Color color, float patchScale = 1) {
batch.Draw(texture, destinationRectangle, color, 0, Vector2.Zero, SpriteEffects.None, 0, patchScale);
}

View file

@ -2,7 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.Extensions {
namespace MLEM.Textures {
/// <summary>
/// A set of extensions for dealing with <see cref="Texture2D"/>
/// </summary>

View file

@ -1,7 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Graphics;
using MLEM.Maths;
using MLEM.Misc;
namespace MLEM.Textures {

View file

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using FontStashSharp;
@ -10,13 +9,11 @@ using MLEM.Cameras;
using MLEM.Data;
using MLEM.Data.Content;
using MLEM.Extended.Font;
using MLEM.Extensions;
using MLEM.Font;
using MLEM.Formatting;
using MLEM.Formatting.Codes;
using MLEM.Graphics;
using MLEM.Input;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Startup;
using MLEM.Textures;
using MLEM.Ui;

View file

@ -1,4 +1,4 @@
using MLEM.Extensions;
using MLEM.Misc;
using NUnit.Framework;
namespace Tests;

View file

@ -2,7 +2,7 @@ using System;
using System.IO;
using Microsoft.Xna.Framework;
using MLEM.Data.Json;
using MLEM.Misc;
using MLEM.Maths;
using Newtonsoft.Json;
using NUnit.Framework;
using Vector2 = Microsoft.Xna.Framework.Vector2;

View file

@ -1,5 +1,5 @@
using Microsoft.Xna.Framework;
using MLEM.Misc;
using MLEM.Maths;
using NUnit.Framework;
namespace Tests;

View file

@ -1,13 +1,9 @@
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MLEM.Extended.Maths;
using NUnit.Framework;
using RectangleF = MLEM.Misc.RectangleF;
#if !FNA
using RectangleF = MLEM.Maths.RectangleF;
using MLEM.Maths;
using MonoGame.Extended;
using MLEM.Extended.Extensions;
#endif
namespace Tests;
public class NumberTests {
@ -73,7 +69,6 @@ public class NumberTests {
Assert.AreEqual(penetration, 0);
}
#if !FNA
[Test]
public void TestRangePercentage() {
Assert.AreEqual(0.5F, new Range<int>(1, 7).GetPercentage(4));
@ -95,6 +90,5 @@ public class NumberTests {
Assert.AreEqual(11, new Range<float>(8, 10).FromPercentage(1.5F));
Assert.AreEqual(7, new Range<float>(8, 10).FromPercentage(-0.5F));
}
#endif
}

View file

@ -2,7 +2,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
using MLEM.Misc;
using MLEM.Maths;
using NUnit.Framework;
namespace Tests;

View file

@ -18,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ThirdParty\MonoGame.Extended\source\MonoGame.Extended\FNA.Extended.csproj" />
<ProjectReference Include="..\ThirdParty\FNA\FNA.Core.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Data;
using MLEM.Textures;

View file

@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Misc;
using MLEM.Maths;
using MLEM.Ui;
using MLEM.Ui.Elements;
using MLEM.Ui.Style;