diff --git a/Demos.DesktopGL/Program.cs b/Demos.DesktopGL/Program.cs index d6abd58..5ad71f6 100644 --- a/Demos.DesktopGL/Program.cs +++ b/Demos.DesktopGL/Program.cs @@ -6,8 +6,8 @@ namespace Demos.DesktopGL { public static void Main() { TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c); - using (var game = new GameImpl()) - game.Run(); + using var game = new GameImpl(); + game.Run(); } } diff --git a/MLEM.Extended/Tiled/TiledMapCollisions.cs b/MLEM.Extended/Tiled/TiledMapCollisions.cs index b081209..ccfcfbc 100644 --- a/MLEM.Extended/Tiled/TiledMapCollisions.cs +++ b/MLEM.Extended/Tiled/TiledMapCollisions.cs @@ -128,18 +128,19 @@ namespace MLEM.Extended.Tiled { /// /// Returns an enumerable of normals and penetration amounts for each that intersects with the given area. /// The normals and penetration amounts are based on . - /// Note that all x penetrations are returned before all y penetrations, which improves collision detection in sidescrolling games with gravity. + /// 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 . /// /// The area to penetrate /// A function that determines if a certain info should be included or not + /// Whether all x penetrations should be prioritized (returned first). If this is false, all y penetrations are prioritized instead. /// A set of normals and penetration amounts - public IEnumerable<(Vector2, float)> GetPenetrations(Func getArea, Func included = null) { + public IEnumerable<(Vector2, float)> GetPenetrations(Func getArea, Func included = null, bool prioritizeX = true) { foreach (var col in this.GetCollidingAreas(getArea(), included)) { - if (getArea().Penetrate(col, out var normal, out var penetration) && normal.X != 0) + if (getArea().Penetrate(col, out var normal, out var penetration) && normal.X != 0 == prioritizeX) yield return (normal, penetration); } foreach (var col in this.GetCollidingAreas(getArea(), included)) { - if (getArea().Penetrate(col, out var normal, out var penetration) && normal.Y != 0) + if (getArea().Penetrate(col, out var normal, out var penetration) && normal.X == 0 == prioritizeX) yield return (normal, penetration); } } diff --git a/MLEM.Templates/content/MLEM.Templates.DesktopGL/Program.cs b/MLEM.Templates/content/MLEM.Templates.DesktopGL/Program.cs index f6807c1..bd48aeb 100644 --- a/MLEM.Templates/content/MLEM.Templates.DesktopGL/Program.cs +++ b/MLEM.Templates/content/MLEM.Templates.DesktopGL/Program.cs @@ -6,8 +6,8 @@ namespace TemplateNamespace { public static void Main() { TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c); - using (var game = new GameImpl()) - game.Run(); + using var game = new GameImpl(); + game.Run(); } } diff --git a/MLEM/Misc/AutoTiling.cs b/MLEM/Misc/AutoTiling.cs index 042fe57..caf3997 100644 --- a/MLEM/Misc/AutoTiling.cs +++ b/MLEM/Misc/AutoTiling.cs @@ -6,7 +6,7 @@ namespace MLEM.Misc { /// This class contains a method that allows users to easily draw a tile with automatic connections. /// For auto-tiling in this manner to work, auto-tiled textures have to be laid out in a format described in . /// - public class AutoTiling { + public static class AutoTiling { /// /// This method allows for a tiled texture to be drawn in an auto-tiling mode. diff --git a/Sandbox/GameImpl.cs b/Sandbox/GameImpl.cs index 42032db..b591010 100644 --- a/Sandbox/GameImpl.cs +++ b/Sandbox/GameImpl.cs @@ -21,7 +21,6 @@ using MLEM.Textures; using MLEM.Ui; using MLEM.Ui.Elements; using MLEM.Ui.Style; -using MonoGame.Extended.BitmapFonts; using MonoGame.Extended.Tiled; namespace Sandbox { diff --git a/Sandbox/Program.cs b/Sandbox/Program.cs index cd8cb41..646e1b3 100644 --- a/Sandbox/Program.cs +++ b/Sandbox/Program.cs @@ -6,8 +6,8 @@ namespace Sandbox { private static void Main() { TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c); - using (var game = new GameImpl()) - game.Run(); + using var game = new GameImpl(); + game.Run(); } }