From fc026ad0dedcb964068af118307516f66d827b67 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 14 Sep 2022 19:24:00 +0200 Subject: [PATCH] multi-target netstandard2.0 and net6.0 --- MLEM.Data/DataTextureAtlas.cs | 3 --- MLEM.Data/MLEM.Data.FNA.csproj | 2 +- MLEM.Data/MLEM.Data.csproj | 2 +- MLEM.Extended/MLEM.Extended.FNA.csproj | 2 +- MLEM.Extended/MLEM.Extended.csproj | 12 ++++++------ MLEM.Startup/MLEM.Startup.FNA.csproj | 2 +- MLEM.Startup/MLEM.Startup.csproj | 12 ++++++------ MLEM.Templates/MLEM.Templates.csproj | 10 +++++----- MLEM.Ui/MLEM.Ui.FNA.csproj | 2 +- MLEM.Ui/MLEM.Ui.csproj | 12 ++++++------ MLEM/Input/InputHandler.cs | 3 +++ MLEM/MLEM.FNA.csproj | 2 +- MLEM/MLEM.csproj | 2 +- MLEM/Misc/EnumHelper.cs | 6 +++++- 14 files changed, 38 insertions(+), 34 deletions(-) diff --git a/MLEM.Data/DataTextureAtlas.cs b/MLEM.Data/DataTextureAtlas.cs index fcd15c5..e163e72 100644 --- a/MLEM.Data/DataTextureAtlas.cs +++ b/MLEM.Data/DataTextureAtlas.cs @@ -9,9 +9,6 @@ using Microsoft.Xna.Framework.Graphics; using MLEM.Extensions; using MLEM.Misc; using MLEM.Textures; -#if FNA -using MLEM.Extensions; -#endif namespace MLEM.Data { /// diff --git a/MLEM.Data/MLEM.Data.FNA.csproj b/MLEM.Data/MLEM.Data.FNA.csproj index d4dae9c..b247ae1 100644 --- a/MLEM.Data/MLEM.Data.FNA.csproj +++ b/MLEM.Data/MLEM.Data.FNA.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true MLEM.Data diff --git a/MLEM.Data/MLEM.Data.csproj b/MLEM.Data/MLEM.Data.csproj index 4d47947..109e6ff 100644 --- a/MLEM.Data/MLEM.Data.csproj +++ b/MLEM.Data/MLEM.Data.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true NU1701 diff --git a/MLEM.Extended/MLEM.Extended.FNA.csproj b/MLEM.Extended/MLEM.Extended.FNA.csproj index dd8d810..7357d76 100644 --- a/MLEM.Extended/MLEM.Extended.FNA.csproj +++ b/MLEM.Extended/MLEM.Extended.FNA.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true MLEM.Extended diff --git a/MLEM.Extended/MLEM.Extended.csproj b/MLEM.Extended/MLEM.Extended.csproj index f66d8fb..ff63ed3 100644 --- a/MLEM.Extended/MLEM.Extended.csproj +++ b/MLEM.Extended/MLEM.Extended.csproj @@ -1,10 +1,10 @@  - netstandard2.0 + netstandard2.0;net6.0 true true - + Ellpeck MLEM Library for Extending MonoGame extension that ties in with MonoGame.Extended and other MonoGame libraries @@ -16,10 +16,10 @@ Logo.png README.md - + - + all @@ -33,9 +33,9 @@ all - + - \ No newline at end of file + diff --git a/MLEM.Startup/MLEM.Startup.FNA.csproj b/MLEM.Startup/MLEM.Startup.FNA.csproj index 57e5474..2ff3745 100644 --- a/MLEM.Startup/MLEM.Startup.FNA.csproj +++ b/MLEM.Startup/MLEM.Startup.FNA.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0;net6.0 true true MLEM.Startup diff --git a/MLEM.Startup/MLEM.Startup.csproj b/MLEM.Startup/MLEM.Startup.csproj index 95db618..871862c 100644 --- a/MLEM.Startup/MLEM.Startup.csproj +++ b/MLEM.Startup/MLEM.Startup.csproj @@ -1,11 +1,11 @@  - + - netstandard2.0 + netstandard2.0;net6.0 true true - + Ellpeck MLEM Library for Extending MonoGame combined with some other useful libraries into a quick Game startup class @@ -17,17 +17,17 @@ Logo.png README.md - + - + all - + diff --git a/MLEM.Templates/MLEM.Templates.csproj b/MLEM.Templates/MLEM.Templates.csproj index ac2d3e9..d3a5f13 100644 --- a/MLEM.Templates/MLEM.Templates.csproj +++ b/MLEM.Templates/MLEM.Templates.csproj @@ -1,14 +1,14 @@  - + - netstandard2.0 + netstandard2.0;net6.0 true false content true NU5128 - + Template MLEM Templates @@ -21,7 +21,7 @@ Logo.png README.md - + @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/MLEM.Ui/MLEM.Ui.FNA.csproj b/MLEM.Ui/MLEM.Ui.FNA.csproj index 23f0414..b3d713a 100644 --- a/MLEM.Ui/MLEM.Ui.FNA.csproj +++ b/MLEM.Ui/MLEM.Ui.FNA.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true MLEM.Ui diff --git a/MLEM.Ui/MLEM.Ui.csproj b/MLEM.Ui/MLEM.Ui.csproj index e9aecaa..7f7727b 100644 --- a/MLEM.Ui/MLEM.Ui.csproj +++ b/MLEM.Ui/MLEM.Ui.csproj @@ -1,10 +1,10 @@  - netstandard2.0 + netstandard2.0;net6.0 true true - + Ellpeck A mouse, keyboard, gamepad and touch ready Ui system for MonoGame that features automatic anchoring, sizing and several ready-to-use element types @@ -16,18 +16,18 @@ Logo.png README.md - + - + all - + - \ No newline at end of file + diff --git a/MLEM/Input/InputHandler.cs b/MLEM/Input/InputHandler.cs index 9856a7f..af2110c 100644 --- a/MLEM/Input/InputHandler.cs +++ b/MLEM/Input/InputHandler.cs @@ -823,6 +823,7 @@ namespace MLEM.Input { downTime = DateTime.UtcNow - start; return true; } + downTime = default; return false; } @@ -851,6 +852,7 @@ namespace MLEM.Input { upTime = DateTime.UtcNow - start; return true; } + upTime = default; return false; } @@ -879,6 +881,7 @@ namespace MLEM.Input { lastPressTime = DateTime.UtcNow - start; return true; } + lastPressTime = default; return false; } diff --git a/MLEM/MLEM.FNA.csproj b/MLEM/MLEM.FNA.csproj index 2e28813..4f4ccdd 100644 --- a/MLEM/MLEM.FNA.csproj +++ b/MLEM/MLEM.FNA.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true MLEM diff --git a/MLEM/MLEM.csproj b/MLEM/MLEM.csproj index 6eb80b7..ac55ac3 100644 --- a/MLEM/MLEM.csproj +++ b/MLEM/MLEM.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.0;net6.0 true true diff --git a/MLEM/Misc/EnumHelper.cs b/MLEM/Misc/EnumHelper.cs index 645f2e8..684aa19 100644 --- a/MLEM/Misc/EnumHelper.cs +++ b/MLEM/Misc/EnumHelper.cs @@ -22,8 +22,12 @@ namespace MLEM.Misc { /// /// The type whose enum to get /// An enumerable of the values of the enum, in declaration order. - public static T[] GetValues() { + public static T[] GetValues() where T : struct, Enum { + #if NET6_0_OR_GREATER + return Enum.GetValues(); + #else return (T[]) Enum.GetValues(typeof(T)); + #endif } }