mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-28 15:28:34 +01:00
Compare commits
3 commits
13436a31ea
...
ecc0c3b963
Author | SHA1 | Date | |
---|---|---|---|
ecc0c3b963 | |||
498e1d8fe6 | |||
677230ce28 |
86 changed files with 171 additions and 149 deletions
|
@ -24,6 +24,7 @@ Additions
|
||||||
|
|
||||||
Improvements
|
Improvements
|
||||||
- **Made the Keybind.Combinations collection a public property**
|
- **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 NumberExtensions.GetPoints to include bottom and right coordinates
|
||||||
- Allow AutoTiling overlayTextures to return null texture regions
|
- Allow AutoTiling overlayTextures to return null texture regions
|
||||||
|
|
||||||
|
@ -56,9 +57,14 @@ Removals
|
||||||
### MLEM.Extended
|
### MLEM.Extended
|
||||||
Improvements
|
Improvements
|
||||||
- **Added compatibility for MonoGame.Extended 4.0.0**
|
- **Added compatibility for MonoGame.Extended 4.0.0**
|
||||||
|
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
|
||||||
- Added compatibility for FNA.Extended
|
- Added compatibility for FNA.Extended
|
||||||
|
|
||||||
### MLEM.Data
|
### MLEM.Data
|
||||||
|
Improvements
|
||||||
|
- **Moved extension methods into matching namespaces to avoid unexpected suggestions**
|
||||||
|
- Allow static json converters to write null values and to throw an exception if a key does not exist
|
||||||
|
|
||||||
Removals
|
Removals
|
||||||
- **Removed obsolete types DynamicEnumConverter, CopyExtensions, DynamicEnum, NetBufferSerializer, and NetExtensions**
|
- **Removed obsolete types DynamicEnumConverter, CopyExtensions, DynamicEnum, NetBufferSerializer, and NetExtensions**
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ using Android.OS;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Extensions;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using Uri = Android.Net.Uri;
|
using Uri = Android.Net.Uri;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Animations;
|
using MLEM.Animations;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
using MLEM.Ui.Elements;
|
using MLEM.Ui.Elements;
|
||||||
|
|
|
@ -4,8 +4,8 @@ using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Pathfinding;
|
using MLEM.Pathfinding;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting;
|
using MLEM.Formatting;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
using MLEM.Misc;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,10 @@ using System.Linq;
|
||||||
using Coroutine;
|
using Coroutine;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting;
|
using MLEM.Formatting;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.Xna.Framework.Content;
|
||||||
using MLEM.Data.Json;
|
using MLEM.Data.Json;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MLEM.Data {
|
namespace MLEM.Data.Content {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="ContentManager"/>
|
/// A set of extensions for dealing with <see cref="ContentManager"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,7 +1,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace MLEM.Data.Content {
|
namespace MLEM.Data.Content {
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MLEM.Data.Json {
|
namespace MLEM.Data.Json {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MLEM.Data.Json {
|
namespace MLEM.Data.Json {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MLEM.Data.Json {
|
namespace MLEM.Data.Json {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
@ -18,14 +17,17 @@ namespace MLEM.Data.Json {
|
||||||
|
|
||||||
private readonly Dictionary<string, T> entries;
|
private readonly Dictionary<string, T> entries;
|
||||||
private readonly Dictionary<T, string> inverse;
|
private readonly Dictionary<T, string> inverse;
|
||||||
|
private readonly bool throwOnRead;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new static json converter using the given underlying <see cref="Dictionary{T,T}"/>.
|
/// Creates a new static json converter using the given underlying <see cref="Dictionary{T,T}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entries">The dictionary to use</param>
|
/// <param name="entries">The dictionary to use</param>
|
||||||
public StaticJsonConverter(Dictionary<string, T> entries) {
|
/// <param name="throwOnRead">Whether to throw a <see cref="KeyNotFoundException"/> in <see cref="ReadJson"/> if a key is missing, or throw a <see cref="JsonSerializationException"/> if a stored json value is not a string. If this is <see langword="false"/>, <see cref="ReadJson"/> returns <see langword="default"/> instead.</param>
|
||||||
|
public StaticJsonConverter(Dictionary<string, T> entries, bool throwOnRead = false) {
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
this.inverse = entries.ToDictionary(kv => kv.Value, kv => kv.Key);
|
this.inverse = StaticJsonConverter<T>.CreateInverse(entries);
|
||||||
|
this.throwOnRead = throwOnRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,13 +41,29 @@ namespace MLEM.Data.Json {
|
||||||
#endif
|
#endif
|
||||||
Type type, string memberName) : this(StaticJsonConverter<T>.GetEntries(type, memberName)) {}
|
Type type, string memberName) : this(StaticJsonConverter<T>.GetEntries(type, memberName)) {}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new static json converter by finding the underlying <see cref="Dictionary{TKey,TValue}"/> from the given type and member name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type that the dictionary is declared in</param>
|
||||||
|
/// <param name="memberName">The name of the dictionary itself</param>
|
||||||
|
/// <param name="throwOnRead">Whether to throw a <see cref="KeyNotFoundException"/> in <see cref="ReadJson"/> if a key is missing, or throw a <see cref="JsonSerializationException"/> if a stored json value is not a string. If this is <see langword="false"/>, <see cref="ReadJson"/> returns <see langword="default"/> instead.</param>
|
||||||
|
public StaticJsonConverter(
|
||||||
|
#if NET6_0_OR_GREATER
|
||||||
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)]
|
||||||
|
#endif
|
||||||
|
Type type, string memberName, bool throwOnRead) : this(StaticJsonConverter<T>.GetEntries(type, memberName), throwOnRead) {}
|
||||||
|
|
||||||
/// <summary>Writes the JSON representation of the object.</summary>
|
/// <summary>Writes the JSON representation of the object.</summary>
|
||||||
/// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param>
|
/// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <param name="serializer">The calling serializer.</param>
|
/// <param name="serializer">The calling serializer.</param>
|
||||||
public override void WriteJson(JsonWriter writer, T value, JsonSerializer serializer) {
|
public override void WriteJson(JsonWriter writer, T value, JsonSerializer serializer) {
|
||||||
|
if (value == null) {
|
||||||
|
writer.WriteNull();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.inverse.TryGetValue(value, out var key))
|
if (!this.inverse.TryGetValue(value, out var key))
|
||||||
throw new InvalidOperationException($"Cannot write {value} that is not a registered entry");
|
throw new KeyNotFoundException($"Cannot write {value} that is not a registered entry");
|
||||||
writer.WriteValue(key);
|
writer.WriteValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +75,15 @@ namespace MLEM.Data.Json {
|
||||||
/// <param name="serializer">The calling serializer.</param>
|
/// <param name="serializer">The calling serializer.</param>
|
||||||
/// <returns>The object value.</returns>
|
/// <returns>The object value.</returns>
|
||||||
public override T ReadJson(JsonReader reader, Type objectType, T existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
public override T ReadJson(JsonReader reader, Type objectType, T existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
||||||
var val = reader.Value?.ToString();
|
if (reader.Value == null)
|
||||||
if (val == null)
|
|
||||||
return default;
|
return default;
|
||||||
this.entries.TryGetValue(val, out var ret);
|
if (reader.TokenType != JsonToken.String) {
|
||||||
|
if (this.throwOnRead)
|
||||||
|
throw new JsonSerializationException($"Expected a string value for {reader.Value}, got a {reader.TokenType}");
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
if (!this.entries.TryGetValue((string) reader.Value, out var ret) && this.throwOnRead)
|
||||||
|
throw new KeyNotFoundException($"Could not find registered entry for {reader.Value}");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,5 +99,15 @@ namespace MLEM.Data.Json {
|
||||||
return value as Dictionary<string, T> ?? throw new InvalidCastException($"{value} is not of expected type {typeof(T)}");
|
return value as Dictionary<string, T> ?? throw new InvalidCastException($"{value} is not of expected type {typeof(T)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Dictionary<T, string> CreateInverse(Dictionary<string, T> entries) {
|
||||||
|
var ret = new Dictionary<T, string>();
|
||||||
|
foreach (var entry in entries) {
|
||||||
|
if (ret.ContainsKey(entry.Value))
|
||||||
|
throw new ArgumentException($"Cannot create a static json converter with duplicate value {entry.Value}");
|
||||||
|
ret.Add(entry.Value, entry.Key);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using static MLEM.Extensions.TextureExtensions;
|
using static MLEM.Textures.TextureExtensions;
|
||||||
|
|
||||||
namespace MLEM.Data {
|
namespace MLEM.Data {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extended.Maths;
|
||||||
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using ShapeExtensions = MonoGame.Extended.ShapeExtensions;
|
using ShapeExtensions = MonoGame.Extended.ShapeExtensions;
|
||||||
using RectangleF = MonoGame.Extended.RectangleF;
|
using RectangleF = MonoGame.Extended.RectangleF;
|
||||||
|
|
||||||
namespace MLEM.Extended.Extensions {
|
namespace MLEM.Extended.Graphics {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extension methods for dealing with <see cref="SpriteBatch"/> and <see cref="RectangleF"/> in combination.
|
/// A set of extension methods for dealing with <see cref="SpriteBatch"/> and <see cref="RectangleF"/> in combination.
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,10 +1,10 @@
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MonoGame.Extended.Graphics;
|
using MonoGame.Extended.Graphics;
|
||||||
using NinePatch = MLEM.Textures.NinePatch;
|
using NinePatch = MLEM.Textures.NinePatch;
|
||||||
using ExtNinePatch = MonoGame.Extended.Graphics.NinePatch;
|
using ExtNinePatch = MonoGame.Extended.Graphics.NinePatch;
|
||||||
|
|
||||||
namespace MLEM.Extended.Extensions {
|
namespace MLEM.Extended.Graphics {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for converting texture-related types between MLEM and MonoGame.Extended.
|
/// A set of extensions for converting texture-related types between MLEM and MonoGame.Extended.
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -37,7 +37,10 @@
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
|
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
|
||||||
<Compile Remove="Tiled/**" />
|
<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" />
|
<Compile Remove="Font/GenericBitmapFont.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,10 @@
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
|
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
|
||||||
<Compile Remove="Tiled/**" />
|
<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" />
|
<Compile Remove="Font/GenericBitmapFont.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,31 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MonoGame.Extended;
|
using MonoGame.Extended;
|
||||||
|
using MlemRectangleF = MLEM.Maths.RectangleF;
|
||||||
|
using ExtRectangleF = MonoGame.Extended.RectangleF;
|
||||||
|
|
||||||
namespace MLEM.Extended.Extensions {
|
namespace MLEM.Extended.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extension methods that convert MLEM types to MonoGame.Extended types and vice versa.
|
/// A set of extension methods that convert MLEM types to MonoGame.Extended types and vice versa.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class NumberExtensions {
|
public static class NumberExtensions {
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="rect">The rectangle to convert</param>
|
/// <param name="rect">The rectangle to convert</param>
|
||||||
/// <returns>The converted rectangle</returns>
|
/// <returns>The converted rectangle</returns>
|
||||||
public static RectangleF ToExtended(this Misc.RectangleF rect) {
|
public static ExtRectangleF ToExtended(this MlemRectangleF rect) {
|
||||||
return new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
|
return new ExtRectangleF(rect.X, rect.Y, rect.Width, rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="rect">The rectangle to convert</param>
|
/// <param name="rect">The rectangle to convert</param>
|
||||||
/// <returns>The converted rectangle</returns>
|
/// <returns>The converted rectangle</returns>
|
||||||
public static Misc.RectangleF ToMlem(this RectangleF rect) {
|
public static MlemRectangleF ToMlem(this ExtRectangleF rect) {
|
||||||
return new Misc.RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
|
return new MlemRectangleF(rect.X, rect.Y, rect.Width, rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -36,7 +38,7 @@ namespace MLEM.Extended.Extensions {
|
||||||
/// <param name="normal">The direction that the penetration occured in</param>
|
/// <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>
|
/// <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>
|
/// <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);
|
return rect.ToMlem().Penetrate(other.ToMlem(), out normal, out penetration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MonoGame.Extended;
|
using MonoGame.Extended;
|
||||||
|
|
||||||
namespace MLEM.Extended.Extensions {
|
namespace MLEM.Extended.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extension methods for dealing with <see cref="Random"/>
|
/// A set of extension methods for dealing with <see cref="Random"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Cameras;
|
using MLEM.Cameras;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MonoGame.Extended.Tiled;
|
using MonoGame.Extended.Tiled;
|
||||||
using RectangleF = MonoGame.Extended.RectangleF;
|
using RectangleF = MonoGame.Extended.RectangleF;
|
||||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MonoGame.Extended;
|
using MonoGame.Extended;
|
||||||
using MonoGame.Extended.Tiled;
|
using MonoGame.Extended.Tiled;
|
||||||
using ColorHelper = MLEM.Extensions.ColorHelper;
|
using ColorHelper = MLEM.Graphics.ColorHelper;
|
||||||
|
|
||||||
namespace MLEM.Extended.Tiled {
|
namespace MLEM.Extended.Tiled {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,8 +2,8 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extended.Extensions;
|
using MLEM.Extended.Maths;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MonoGame.Extended.Tiled;
|
using MonoGame.Extended.Tiled;
|
||||||
using RectangleF = MonoGame.Extended.RectangleF;
|
using RectangleF = MonoGame.Extended.RectangleF;
|
||||||
|
@ -125,7 +125,7 @@ namespace MLEM.Extended.Tiled {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an enumerable of normals and penetration amounts for each <see cref="TileCollisionInfo"/> that intersects with the given <see cref="RectangleF"/> area.
|
/// 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"/>.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="getArea">The area to penetrate</param>
|
/// <param name="getArea">The area to penetrate</param>
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -6,9 +6,9 @@ using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Sound;
|
using MLEM.Sound;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,9 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
#if FNA
|
|
||||||
using MLEM.Extensions;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3,9 +3,8 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting;
|
using MLEM.Formatting;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,12 +5,9 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input.Touch;
|
using Microsoft.Xna.Framework.Input.Touch;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
#if FNA
|
|
||||||
using MLEM.Extensions;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
using Color = Microsoft.Xna.Framework.Color;
|
using Color = Microsoft.Xna.Framework.Color;
|
||||||
using RectangleF = MLEM.Misc.RectangleF;
|
using RectangleF = MLEM.Maths.RectangleF;
|
||||||
#if FNA
|
#if FNA
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MLEM.Ui.Elements {
|
namespace MLEM.Ui.Elements {
|
||||||
|
|
|
@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting;
|
using MLEM.Formatting;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Sound;
|
using MLEM.Sound;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Graphics;
|
||||||
|
|
||||||
namespace MLEM.Ui.Style {
|
namespace MLEM.Ui.Style {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -5,12 +5,12 @@ using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using Microsoft.Xna.Framework.Input.Touch;
|
using Microsoft.Xna.Framework.Input.Touch;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Ui.Elements;
|
using MLEM.Ui.Elements;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
#if NET452
|
#if NET452
|
||||||
using MLEM.Extensions;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MLEM.Ui {
|
namespace MLEM.Ui {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
|
||||||
|
|
||||||
namespace MLEM.Cameras {
|
namespace MLEM.Cameras {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
|
@ -2,9 +2,9 @@ using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Animations;
|
using MLEM.Animations;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Misc;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace MLEM.Formatting.Codes {
|
namespace MLEM.Formatting.Codes {
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using System;
|
using System.Text.RegularExpressions;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Misc;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Formatting.Codes {
|
namespace MLEM.Formatting.Codes {
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
|
using MLEM.Graphics;
|
||||||
|
|
||||||
namespace MLEM.Formatting.Codes {
|
namespace MLEM.Formatting.Codes {
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Misc;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Formatting.Codes {
|
namespace MLEM.Formatting.Codes {
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -4,9 +4,9 @@ using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
|
using MLEM.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Formatting {
|
namespace MLEM.Formatting {
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Formatting {
|
namespace MLEM.Formatting {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -6,6 +5,7 @@ using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Formatting {
|
namespace MLEM.Formatting {
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace MLEM.Graphics {
|
namespace MLEM.Graphics {
|
||||||
|
@ -128,7 +128,7 @@ namespace MLEM.Graphics {
|
||||||
AutoTiling.DrawExtendedAutoTileCorner(batch, pos, overlayTextures, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od);
|
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) {
|
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);
|
var src = AutoTiling.CalculateExtendedAutoTileOffset(connectsTo, corner);
|
||||||
if (src >= 0) {
|
if (src >= 0) {
|
||||||
|
@ -151,7 +151,7 @@ namespace MLEM.Graphics {
|
||||||
AutoTiling.AddExtendedAutoTileCorner(batch, pos, overlayTexture, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od, items);
|
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) {
|
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);
|
var src = AutoTiling.CalculateExtendedAutoTile(overlayTexture.Area, connectsTo, corner);
|
||||||
if (src != Rectangle.Empty) {
|
if (src != Rectangle.Empty) {
|
||||||
|
@ -173,7 +173,7 @@ namespace MLEM.Graphics {
|
||||||
AutoTiling.AddExtendedAutoTileCorner(batch, pos, overlayTextures, connectsTo, overlayColor, Direction2.DownRight, origin, scale, od, items);
|
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) {
|
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);
|
var src = AutoTiling.CalculateExtendedAutoTileOffset(connectsTo, corner);
|
||||||
if (src >= 0) {
|
if (src >= 0) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Graphics {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="Color"/> objects.
|
/// A set of extensions for dealing with <see cref="Color"/> objects.
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Graphics {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="GraphicsDevice"/> and <see cref="GraphicsDeviceManager"/>
|
/// A set of extensions for dealing with <see cref="GraphicsDevice"/> and <see cref="GraphicsDeviceManager"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,10 +1,9 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Graphics;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Graphics {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="SpriteBatch"/>
|
/// A set of extensions for dealing with <see cref="SpriteBatch"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
#if FNA
|
#if FNA
|
||||||
using MLEM.Extensions;
|
using MLEM.Maths;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
#if NET452
|
#if NET452
|
||||||
using MLEM.Extensions;
|
using MLEM.Misc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MLEM.Input {
|
namespace MLEM.Input {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
|
@ -5,8 +5,9 @@ using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Input {
|
namespace MLEM.Input {
|
||||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An enum that represents two-dimensional directions.
|
/// An enum that represents two-dimensional directions.
|
||||||
/// Both straight and diagonal directions are supported.
|
/// Both straight and diagonal directions are supported.
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class contains a set of easing functions, adapted from https://easings.net.
|
/// 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.
|
/// These can be used for ui elements or any other kind of animations.
|
||||||
|
@ -11,12 +11,12 @@ namespace MLEM.Misc {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An easing function that constantly returns 0, regardless of the input percentage.
|
/// 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>
|
/// </summary>
|
||||||
public static readonly Easing Zero = p => 0;
|
public static readonly Easing Zero = p => 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An easing function that constantly returns 1, regardless of the input percentage.
|
/// 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>
|
/// </summary>
|
||||||
public static readonly Easing One = p => 1;
|
public static readonly Easing One = p => 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -160,7 +160,7 @@ namespace MLEM.Misc {
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="easing">The first easing function to play.</param>
|
/// <param name="easing">The first easing function to play.</param>
|
||||||
/// <param name="other">The second easing function to play.</param>
|
/// <param name="other">The second easing function to play.</param>
|
||||||
|
@ -171,7 +171,7 @@ namespace MLEM.Misc {
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="easing">The first easing function to play.</param>
|
/// <param name="easing">The first easing function to play.</param>
|
||||||
/// <param name="others">The next easing functions to play.</param>
|
/// <param name="others">The next easing functions to play.</param>
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <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"/>
|
/// 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>
|
/// </summary>
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a generic padding.
|
/// Represents a generic padding.
|
||||||
/// A padding is an object of data that stores an offset from each side of a rectangle or square.
|
/// A padding is an object of data that stores an offset from each side of a rectangle or square.
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="Random"/>
|
/// A set of extensions for dealing with <see cref="Random"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a float-based version of <see cref="Rectangle"/>
|
/// Represents a float-based version of <see cref="Rectangle"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <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"/>.
|
/// 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.
|
/// 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.
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using MLEM.Extensions;
|
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Maths {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The SingleRandom class allows generating single, one-off pseudorandom numbers based on a seed or a <see cref="SeedSource"/>.
|
/// 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.
|
/// 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));
|
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) {
|
public static T GetRandomWeightedEntry<T>(ICollection<T> entries, Func<T, float> weightFunc, SeedSource source) {
|
||||||
return RandomExtensions.GetRandomWeightedEntry(entries, weightFunc, SingleRandom.Single(source));
|
return RandomExtensions.GetRandomWeightedEntry(entries, weightFunc, SingleRandom.Single(source));
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Misc {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with collections of various kinds
|
/// A set of extensions for dealing with collections of various kinds
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MLEM.Misc {
|
namespace MLEM.Misc {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
|
|
||||||
namespace MLEM.Pathfinding {
|
namespace MLEM.Pathfinding {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
using MLEM.Extensions;
|
|
||||||
|
|
||||||
namespace MLEM.Sound {
|
namespace MLEM.Sound {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Sound {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="SoundEffect"/> and <see cref="SoundEffectInstance"/>
|
/// A set of extensions for dealing with <see cref="SoundEffect"/> and <see cref="SoundEffectInstance"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,7 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Textures {
|
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) {
|
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);
|
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) {
|
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);
|
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) {
|
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);
|
batch.Draw(texture, destinationRectangle, color, 0, Vector2.Zero, SpriteEffects.None, 0, patchScale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace MLEM.Extensions {
|
namespace MLEM.Textures {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extensions for dealing with <see cref="Texture2D"/>
|
/// A set of extensions for dealing with <see cref="Texture2D"/>
|
||||||
/// </summary>
|
/// </summary>
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
|
||||||
namespace MLEM.Textures {
|
namespace MLEM.Textures {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using FontStashSharp;
|
using FontStashSharp;
|
||||||
|
@ -10,13 +9,11 @@ using MLEM.Cameras;
|
||||||
using MLEM.Data;
|
using MLEM.Data;
|
||||||
using MLEM.Data.Content;
|
using MLEM.Data.Content;
|
||||||
using MLEM.Extended.Font;
|
using MLEM.Extended.Font;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Font;
|
using MLEM.Font;
|
||||||
using MLEM.Formatting;
|
using MLEM.Formatting;
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
using MLEM.Graphics;
|
using MLEM.Graphics;
|
||||||
using MLEM.Input;
|
using MLEM.Maths;
|
||||||
using MLEM.Misc;
|
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MLEM.Extensions;
|
using MLEM.Misc;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Data.Json;
|
using MLEM.Data.Json;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extended.Maths;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using RectangleF = MLEM.Misc.RectangleF;
|
using RectangleF = MLEM.Maths.RectangleF;
|
||||||
|
using MLEM.Maths;
|
||||||
#if !FNA
|
|
||||||
using MonoGame.Extended;
|
using MonoGame.Extended;
|
||||||
using MLEM.Extended.Extensions;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
||||||
public class NumberTests {
|
public class NumberTests {
|
||||||
|
@ -73,7 +69,6 @@ public class NumberTests {
|
||||||
Assert.AreEqual(penetration, 0);
|
Assert.AreEqual(penetration, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !FNA
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRangePercentage() {
|
public void TestRangePercentage() {
|
||||||
Assert.AreEqual(0.5F, new Range<int>(1, 7).GetPercentage(4));
|
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(11, new Range<float>(8, 10).FromPercentage(1.5F));
|
||||||
Assert.AreEqual(7, new Range<float>(8, 10).FromPercentage(-0.5F));
|
Assert.AreEqual(7, new Range<float>(8, 10).FromPercentage(-0.5F));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ThirdParty\MonoGame.Extended\source\MonoGame.Extended\FNA.Extended.csproj" />
|
||||||
<ProjectReference Include="..\ThirdParty\FNA\FNA.Core.csproj" />
|
<ProjectReference Include="..\ThirdParty\FNA\FNA.Core.csproj" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Data;
|
using MLEM.Data;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Misc;
|
using MLEM.Maths;
|
||||||
using MLEM.Ui;
|
using MLEM.Ui;
|
||||||
using MLEM.Ui.Elements;
|
using MLEM.Ui.Elements;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
Loading…
Reference in a new issue