diff --git a/build/Stride.AllPlatforms.bat b/build/Stride.AllPlatforms.bat index 1aa1b4f45..a92103daa 100644 --- a/build/Stride.AllPlatforms.bat +++ b/build/Stride.AllPlatforms.bat @@ -1,2 +1,2 @@ -set StridePlatforms=Windows;UWP;Android;iOS;Linux +set StridePlatforms=Windows;Android;iOS;Linux Stride.sln diff --git a/build/Stride.UWP.bat b/build/Stride.UWP.bat deleted file mode 100644 index 1b167e372..000000000 --- a/build/Stride.UWP.bat +++ /dev/null @@ -1,2 +0,0 @@ -set StridePlatforms=Windows;UWP -Stride.Runtime.sln diff --git a/build/Stride.build b/build/Stride.build index 7e7180daa..b7b20c304 100644 --- a/build/Stride.build +++ b/build/Stride.build @@ -92,7 +92,7 @@ Example of use: @@ -185,15 +185,6 @@ Example of use: - - - $(StrideSolution).Runtime - UWP - - - - - diff --git a/deps/BulletPhysics/UWP/ARM/libbulletc.dll b/deps/BulletPhysics/UWP/ARM/libbulletc.dll deleted file mode 100644 index 7de06f29a..000000000 --- a/deps/BulletPhysics/UWP/ARM/libbulletc.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e66db69a02c1d423dc5dd01354129c459b9f6207ee4f94e4f81ebe7bc671c10c -size 1321472 diff --git a/deps/BulletPhysics/UWP/x64/libbulletc.dll b/deps/BulletPhysics/UWP/x64/libbulletc.dll deleted file mode 100644 index 928b91ad4..000000000 --- a/deps/BulletPhysics/UWP/x64/libbulletc.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a3216d1b3ee9829fdb1eba3d007f36ef22f2fd32f5af7b8c62262ab874037cd5 -size 1835520 diff --git a/deps/BulletPhysics/UWP/x86/libbulletc.dll b/deps/BulletPhysics/UWP/x86/libbulletc.dll deleted file mode 100644 index 614a48ae0..000000000 --- a/deps/BulletPhysics/UWP/x86/libbulletc.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d10abaf888b6d62b6f792b13984af90b7f4948dea6893b75d81763979be0ea6 -size 1605632 diff --git a/deps/NativePath/UWP/ARM/Detour.lib b/deps/NativePath/UWP/ARM/Detour.lib deleted file mode 100644 index 8c8f05a5a..000000000 --- a/deps/NativePath/UWP/ARM/Detour.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:681cd1b79152993198be30c9f2775d4ac42cff4ac5c94ec43369baae5e94683d -size 86948 diff --git a/deps/NativePath/UWP/ARM/Recast.lib b/deps/NativePath/UWP/ARM/Recast.lib deleted file mode 100644 index bb90623d5..000000000 --- a/deps/NativePath/UWP/ARM/Recast.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bca2e4a5193fd0d092572e2bd7fea64bb669b9bb5e18b1130bcbf80f65c7158c -size 131760 diff --git a/deps/NativePath/UWP/ARM/libCelt.lib b/deps/NativePath/UWP/ARM/libCelt.lib deleted file mode 100644 index 6b1950d22..000000000 --- a/deps/NativePath/UWP/ARM/libCelt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c539591353b0699f107f3b316ffb47a27078ad8f14351df6c4e065aeac5346ee -size 128102 diff --git a/deps/NativePath/UWP/ARM/libCompilerRt.lib b/deps/NativePath/UWP/ARM/libCompilerRt.lib deleted file mode 100644 index 1cc811762..000000000 --- a/deps/NativePath/UWP/ARM/libCompilerRt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7ee12921b100599a4f0175e310beae8c78e99105103cc76884be23ff77d4b475 -size 100602 diff --git a/deps/NativePath/UWP/ARM/libNativePath.lib b/deps/NativePath/UWP/ARM/libNativePath.lib deleted file mode 100644 index 71498615b..000000000 --- a/deps/NativePath/UWP/ARM/libNativePath.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7ecba0f1f0184957128a8103390f601679bbf388b64ec2adb69a29883b4051c2 -size 965946 diff --git a/deps/NativePath/UWP/x64/Detour.lib b/deps/NativePath/UWP/x64/Detour.lib deleted file mode 100644 index ee2d0d70c..000000000 --- a/deps/NativePath/UWP/x64/Detour.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5aa31cc874045666b65723df029896b45c192eef8f78f88be70af344e35af8b -size 137198 diff --git a/deps/NativePath/UWP/x64/Recast.lib b/deps/NativePath/UWP/x64/Recast.lib deleted file mode 100644 index b22f8cb3c..000000000 --- a/deps/NativePath/UWP/x64/Recast.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:edf28e661a99dc08ac80b4f4eeda267cdd3fd692ddda6ec1cc645b1d005a6fd5 -size 250276 diff --git a/deps/NativePath/UWP/x64/libCelt.lib b/deps/NativePath/UWP/x64/libCelt.lib deleted file mode 100644 index 40165ddda..000000000 --- a/deps/NativePath/UWP/x64/libCelt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fb95b3b8143e4273e252ccf4ce8c80625022603e8333678d21e81a11cae2518f -size 209544 diff --git a/deps/NativePath/UWP/x64/libCompilerRt.lib b/deps/NativePath/UWP/x64/libCompilerRt.lib deleted file mode 100644 index 680fc2a46..000000000 --- a/deps/NativePath/UWP/x64/libCompilerRt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a3b160fc69b348bb3251de3d4fcdedc933bf5455d13ec6f0932f3db53e079143 -size 136992 diff --git a/deps/NativePath/UWP/x64/libNativePath.lib b/deps/NativePath/UWP/x64/libNativePath.lib deleted file mode 100644 index fe5882055..000000000 --- a/deps/NativePath/UWP/x64/libNativePath.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5fe3da1c87cbeace07db41e6b53f4165e6079b16c1a69b5299fe0c44e5522af6 -size 935704 diff --git a/deps/NativePath/UWP/x86/Detour.lib b/deps/NativePath/UWP/x86/Detour.lib deleted file mode 100644 index 8b21b0bf4..000000000 --- a/deps/NativePath/UWP/x86/Detour.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:659b79943f4eb2b45051f3ccec02df4cd1c178b55804ca5860f199d8f88c333e -size 112966 diff --git a/deps/NativePath/UWP/x86/Recast.lib b/deps/NativePath/UWP/x86/Recast.lib deleted file mode 100644 index 4fbd543d0..000000000 --- a/deps/NativePath/UWP/x86/Recast.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e0b65f503483f5bd5b08b0285e399c9c44602b18177773b9c790f50bb30f2771 -size 202526 diff --git a/deps/NativePath/UWP/x86/libCelt.lib b/deps/NativePath/UWP/x86/libCelt.lib deleted file mode 100644 index 1246f5847..000000000 --- a/deps/NativePath/UWP/x86/libCelt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b454d45945ca912a221d3a173c68e322a196a7350d7d53baf4d29678e6f54057 -size 179866 diff --git a/deps/NativePath/UWP/x86/libCompilerRt.lib b/deps/NativePath/UWP/x86/libCompilerRt.lib deleted file mode 100644 index da28113be..000000000 --- a/deps/NativePath/UWP/x86/libCompilerRt.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:35c276ddb54da74b7318f75abda8e0f6827f76a2e26b5380bf5f2057f1f0254f -size 127910 diff --git a/deps/NativePath/UWP/x86/libNativePath.lib b/deps/NativePath/UWP/x86/libNativePath.lib deleted file mode 100644 index 8cc9be472..000000000 --- a/deps/NativePath/UWP/x86/libNativePath.lib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:34dee8da53e831040e58e43c50a62cbafed0ba23204f96c054b11c80509f4cdf -size 932924 diff --git a/deps/OpenAL/README.txt b/deps/OpenAL/README.txt index dce873faf..90c34d25b 100644 --- a/deps/OpenAL/README.txt +++ b/deps/OpenAL/README.txt @@ -1,4 +1,3 @@ Forks: -WIN8.1/UWP: https://github.com/sinkingsugar/openal-soft-winphone iOS: Due to LGPL limitations on openal-soft, we are using Apple OpenAL implementation Other platforms: https://github.com/sinkingsugar/openal-soft \ No newline at end of file diff --git a/deps/freetype/UWP/ARM/freetype.dll b/deps/freetype/UWP/ARM/freetype.dll deleted file mode 100644 index 988eca808..000000000 --- a/deps/freetype/UWP/ARM/freetype.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0a09e3e55f0a281f0b314978fc2f2f672c99bfbb2e6dca6680c35602f869e95c -size 391680 diff --git a/deps/freetype/UWP/ARM/freetype.pdb b/deps/freetype/UWP/ARM/freetype.pdb deleted file mode 100644 index 6f4d64859..000000000 --- a/deps/freetype/UWP/ARM/freetype.pdb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4486b7e189f427fcc5c514abe9aec707b6f840c45688159b4212df7e7d9a72e7 -size 2387968 diff --git a/deps/freetype/UWP/x64/freetype.dll b/deps/freetype/UWP/x64/freetype.dll deleted file mode 100644 index a872aafdd..000000000 --- a/deps/freetype/UWP/x64/freetype.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f62b9561d8f29cd67dab70d626bc940f48ccde52d08bac296bd35c484f710820 -size 573952 diff --git a/deps/freetype/UWP/x64/freetype.pdb b/deps/freetype/UWP/x64/freetype.pdb deleted file mode 100644 index 770238032..000000000 --- a/deps/freetype/UWP/x64/freetype.pdb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9909872d149a4259b46bc4abd7682cf8a8b639cea819dfa1f07a066b50129bc1 -size 2404352 diff --git a/deps/freetype/UWP/x86/freetype.dll b/deps/freetype/UWP/x86/freetype.dll deleted file mode 100644 index 1c03edaf7..000000000 --- a/deps/freetype/UWP/x86/freetype.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2ceca2ae9425906e2fe119b42aa4602bf43a8d4ca761e7706dee2d14fbc78b4e -size 464384 diff --git a/deps/freetype/UWP/x86/freetype.pdb b/deps/freetype/UWP/x86/freetype.pdb deleted file mode 100644 index e8496ba21..000000000 --- a/deps/freetype/UWP/x86/freetype.pdb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c02365ce580c66c8e670c34d55d0bb8aafe799e1d35fa993254b651ea45ff739 -size 2592768 diff --git a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/ARM/NativeLibrary.dll b/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/ARM/NativeLibrary.dll deleted file mode 100644 index 427537217..000000000 --- a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/ARM/NativeLibrary.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b67c53b92ee7560552d8cc3d87a6ede45c0455b757b68f3127308e5e607a679e -size 133120 diff --git a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x64/NativeLibrary.dll b/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x64/NativeLibrary.dll deleted file mode 100644 index 54b33099c..000000000 --- a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x64/NativeLibrary.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:079a5d03b84bab78cc451b148163e2a224738e87a609f74d5bf0c77681b306ee -size 139776 diff --git a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x86/NativeLibrary.dll b/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x86/NativeLibrary.dll deleted file mode 100644 index 756508a4e..000000000 --- a/samples/Templates/VRSandbox/VRSandbox/NativeLibs/UWP/x86/NativeLibrary.dll +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5d4c9d21a84bec3583626218e7abbca921a125cc7f0ae95d62e997a99e3149e -size 115200 diff --git a/sources/assets/Stride.Core.Assets.CompilerApp/build/Stride.Core.Assets.CompilerApp.targets b/sources/assets/Stride.Core.Assets.CompilerApp/build/Stride.Core.Assets.CompilerApp.targets index 2e78878e5..6097e7624 100644 --- a/sources/assets/Stride.Core.Assets.CompilerApp/build/Stride.Core.Assets.CompilerApp.targets +++ b/sources/assets/Stride.Core.Assets.CompilerApp/build/Stride.Core.Assets.CompilerApp.targets @@ -165,16 +165,8 @@ - - - - $(OutputPath)\$(AppxPackageDirName)\ - $(AppxPackageDir)Test\ - $(AssemblyName) - - - - + + _StrideDeployAssetsAsContent; $(PrepareResourcesDependsOn) diff --git a/sources/assets/Stride.Core.Assets/PackageSession.Dependencies.cs b/sources/assets/Stride.Core.Assets/PackageSession.Dependencies.cs index 6a05d5ce1..6081c13ac 100644 --- a/sources/assets/Stride.Core.Assets/PackageSession.Dependencies.cs +++ b/sources/assets/Stride.Core.Assets/PackageSession.Dependencies.cs @@ -64,7 +64,6 @@ namespace Stride.Core.Assets var outputType = msProject.GetPropertyValue("OutputType"); project.Type = outputType.ToLowerInvariant() == "winexe" || outputType.ToLowerInvariant() == "exe" - || outputType.ToLowerInvariant() == "appcontainerexe" // UWP || msProject.GetPropertyValue("AndroidApplication").ToLowerInvariant() == "true" // Android ? ProjectType.Executable : ProjectType.Library; diff --git a/sources/core/Stride.Core.IO/NativeLockFile.cs b/sources/core/Stride.Core.IO/NativeLockFile.cs index 9f9534f5a..a2afda4d5 100644 --- a/sources/core/Stride.Core.IO/NativeLockFile.cs +++ b/sources/core/Stride.Core.IO/NativeLockFile.cs @@ -29,7 +29,7 @@ namespace Stride.Core.IO count = (count + offset > int.MaxValue) ? int.MaxValue - offset : count; } - if (Platform.Type == PlatformType.Windows || Platform.Type == PlatformType.UWP) + if (Platform.Type == PlatformType.Windows) { var countLow = (uint)count; var countHigh = (uint)(count >> 32); @@ -74,7 +74,7 @@ namespace Stride.Core.IO count = (count + offset > int.MaxValue) ? int.MaxValue - offset : count; } - if (Platform.Type == PlatformType.Windows || Platform.Type == PlatformType.UWP) + if (Platform.Type == PlatformType.Windows) { var countLow = (uint)count; var countHigh = (uint)(count >> 32); diff --git a/sources/core/Stride.Core.IO/Stride.Core.IO.csproj b/sources/core/Stride.Core.IO/Stride.Core.IO.csproj index 731228df4..c64fa2f7b 100644 --- a/sources/core/Stride.Core.IO/Stride.Core.IO.csproj +++ b/sources/core/Stride.Core.IO/Stride.Core.IO.csproj @@ -28,7 +28,6 @@ contentfiles;analyzers - diff --git a/sources/core/Stride.Core/Diagnostics/ConsoleLogListener.cs b/sources/core/Stride.Core/Diagnostics/ConsoleLogListener.cs index 3f9a5a5a1..0cee447f6 100644 --- a/sources/core/Stride.Core/Diagnostics/ConsoleLogListener.cs +++ b/sources/core/Stride.Core/Diagnostics/ConsoleLogListener.cs @@ -112,14 +112,12 @@ namespace Stride.Core.Diagnostics } } -#if !STRIDE_PLATFORM_UWP // Log the actual message Console.WriteLine(GetDefaultText(logMessage)); if (!string.IsNullOrEmpty(exceptionMsg)) { Console.WriteLine(exceptionMsg); } -#endif #if STRIDE_PLATFORM_DESKTOP diff --git a/sources/core/Stride.Core/Platform.cs b/sources/core/Stride.Core/Platform.cs index 17daebed9..2d2fedf77 100644 --- a/sources/core/Stride.Core/Platform.cs +++ b/sources/core/Stride.Core/Platform.cs @@ -14,12 +14,6 @@ namespace Stride.Core /// public static class Platform { -#if STRIDE_PLATFORM_UWP - /// - /// The current running . - /// - public static readonly PlatformType Type = PlatformType.UWP; -#else /// /// The current running . /// @@ -30,7 +24,6 @@ namespace Stride.Core : OperatingSystem.IsAndroid() ? PlatformType.Android : OperatingSystem.IsIOS() ? PlatformType.iOS : PlatformType.Windows; // For now we use Windows as fallback, but it might be better to throw an exception? -#endif /// /// Gets a value indicating whether the running platform is windows desktop. diff --git a/sources/core/Stride.Core/PlatformFolders.cs b/sources/core/Stride.Core/PlatformFolders.cs index 086b7dcde..9de3e2a26 100644 --- a/sources/core/Stride.Core/PlatformFolders.cs +++ b/sources/core/Stride.Core/PlatformFolders.cs @@ -98,8 +98,6 @@ namespace Stride.Core var directory = Path.Combine(PlatformAndroid.Context.FilesDir.AbsolutePath, "local"); Directory.CreateDirectory(directory); return directory; -#elif STRIDE_PLATFORM_UWP - return Windows.Storage.ApplicationData.Current.LocalFolder.Path; #elif STRIDE_PLATFORM_IOS var directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", "Local"); Directory.CreateDirectory(directory); @@ -117,20 +115,14 @@ namespace Stride.Core { #if STRIDE_PLATFORM_ANDROID var directory = Path.Combine(PlatformAndroid.Context.FilesDir.AbsolutePath, "roaming"); - Directory.CreateDirectory(directory); - return directory; -#elif STRIDE_PLATFORM_UWP - return Windows.Storage.ApplicationData.Current.RoamingFolder.Path; #elif STRIDE_PLATFORM_IOS var directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", "Roaming"); - Directory.CreateDirectory(directory); - return directory; #else // TODO: Should we add "local" ? var directory = Path.Combine(GetApplicationBinaryDirectory(), "roaming"); +#endif Directory.CreateDirectory(directory); return directory; -#endif } [NotNull] @@ -138,8 +130,6 @@ namespace Stride.Core { #if STRIDE_PLATFORM_ANDROID var directory = Path.Combine(PlatformAndroid.Context.FilesDir.AbsolutePath, "cache"); -#elif STRIDE_PLATFORM_UWP - var directory = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "cache"); #elif STRIDE_PLATFORM_IOS var directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", "Caches"); #else @@ -177,8 +167,6 @@ namespace Stride.Core { #if STRIDE_PLATFORM_ANDROID return PlatformAndroid.Context.CacheDir.AbsolutePath; -#elif STRIDE_PLATFORM_UWP - return Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; #elif STRIDE_PLATFORM_IOS return Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "tmp"); #else @@ -211,8 +199,6 @@ namespace Stride.Core #else return AppDomain.CurrentDomain.BaseDirectory; #endif -#elif STRIDE_PLATFORM_UWP - return Windows.ApplicationModel.Package.Current.InstalledLocation.Path; #else throw new NotImplementedException(); #endif @@ -225,8 +211,6 @@ namespace Stride.Core return Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/Android/data/" + PlatformAndroid.Context.PackageName + "/data"; #elif STRIDE_PLATFORM_IOS return Foundation.NSBundle.MainBundle.BundlePath + "/data"; -#elif STRIDE_PLATFORM_UWP - return Windows.ApplicationModel.Package.Current.InstalledLocation.Path + @"\data"; #else return Path.Combine(GetApplicationBinaryDirectory(), "data"); #endif diff --git a/sources/core/Stride.Core/PlatformType.cs b/sources/core/Stride.Core/PlatformType.cs index 35f863a07..624e3666a 100644 --- a/sources/core/Stride.Core/PlatformType.cs +++ b/sources/core/Stride.Core/PlatformType.cs @@ -45,11 +45,6 @@ namespace Stride.Core iOS, #pragma warning restore SA1300 // Element must begin with upper-case letter - /// - /// The Universal Windows Platform (UWP). - /// - UWP, - /// /// The Linux OS. /// diff --git a/sources/core/Stride.Core/Stride.Core.csproj b/sources/core/Stride.Core/Stride.Core.csproj index 1504bb92a..f9d2487c5 100644 --- a/sources/core/Stride.Core/Stride.Core.csproj +++ b/sources/core/Stride.Core/Stride.Core.csproj @@ -15,7 +15,6 @@ --auto-module-initializer --serialization * true - 6.2.12 diff --git a/sources/core/Stride.Core/build/Stride.Core.targets b/sources/core/Stride.Core/build/Stride.Core.targets index b052b22ca..1b08417a5 100644 --- a/sources/core/Stride.Core/build/Stride.Core.targets +++ b/sources/core/Stride.Core/build/Stride.Core.targets @@ -26,7 +26,6 @@ --> - UWP Android iOS macOS @@ -177,19 +176,6 @@ - - - x86 - x64 - ARM - - - - PreserveNewest - $([System.String]::Copy('%(_StrideDependencyNativeLib.Link)').Replace('$(StrideCPU)\', '')) - - - diff --git a/sources/editor/Stride.Assets.Presentation/Resources/Icons/uwp.png b/sources/editor/Stride.Assets.Presentation/Resources/Icons/uwp.png deleted file mode 100644 index ed9de30e8..000000000 --- a/sources/editor/Stride.Assets.Presentation/Resources/Icons/uwp.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e153c15bff3544be86cc386c2bc964715de579940b3e789cc6b66fbdb1aff525 -size 400 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/Common.UWP.targets.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/Common.UWP.targets.t4 deleted file mode 100644 index 0c8fa319e..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/Common.UWP.targets.t4 +++ /dev/null @@ -1,22 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -<# - var currentPlatform = (Stride.Core.PlatformType)Properties.CurrentPlatform; - var orientation = "landscape"; - switch ((Stride.Graphics.DisplayOrientation)Properties.Orientation) - { - case Stride.Graphics.DisplayOrientation.LandscapeRight: - orientation = "landscape"; - break; - case Stride.Graphics.DisplayOrientation.LandscapeLeft: - orientation = "landscapeFlipped"; - break; - case Stride.Graphics.DisplayOrientation.Portrait: - orientation = "portrait"; - break; - } -#> -<# if (orientation != null) { #> - - - -<# } #> \ No newline at end of file diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon100x100.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon100x100.png deleted file mode 100644 index c5a11946f..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon100x100.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8df9a7eb201c9b5791689d772536d19b8ca49f28f6080f21d5fd55122bfc2637 -size 2143 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon150x150.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon150x150.png deleted file mode 100644 index 467ca7b94..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon150x150.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:87a685d6c49d6b28347a1abf8330949d4736945b2899b6ddfaf322245c818450 -size 2942 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon300x300.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon300x300.png deleted file mode 100644 index d5ee0baab..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon300x300.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:42531391f97e2b92c8f8544d9a7fbbb1f46500024dcf06bf38b4ca1713ef337f -size 6207 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon44x44.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon44x44.png deleted file mode 100644 index 7de8403c9..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon44x44.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7b695ff9bbedee79816e06e31194bb52643a9a791ffdd84ed193ea9830fbd237 -size 1170 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon50x50.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon50x50.png deleted file mode 100644 index c12b3443c..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon50x50.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6ca2cd25cc79acc4b39cc1c7c927e3bc1ee4deb66a2ca86fe43002b903592663 -size 1282 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon88x88.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon88x88.png deleted file mode 100644 index 97dbe824e..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameIcon88x88.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dcd9915e836c286f69e20039d450c77c4370593d299c1c5d129659db752b1ee3 -size 1850 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen1240x600.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen1240x600.png deleted file mode 100644 index b62feb064..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen1240x600.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9fe96890fd8f6bf612efec69844b8b89be31bd5f02fe4df67ce01f4b6882aa84 -size 25455 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen620x300.png b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen620x300.png deleted file mode 100644 index 98b9e7152..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Assets/GameSplashScreen620x300.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a15881fa169c3339fa0daa542104aa8177e6ae6e4e4ab6949a2620173f0f3e50 -size 10821 diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/$ProjectName$.csproj.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/$ProjectName$.csproj.t4 deleted file mode 100644 index 65af8f130..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/$ProjectName$.csproj.t4 +++ /dev/null @@ -1,74 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - - - Debug - x86 - {<#= ProjectGuid.ToString().ToUpperInvariant() #>} - AppContainerExe - PackageReference - Properties - <#= Properties.Namespace #> - <#= Properties.PackageName #> - en-US - UAP - 10.0.17134.0 - 10.0.16299.0 - 14 - true - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - <#= ProjectName #>.TemporaryKey.pfx - obj\ - - true - -<#@ include file="..\..\Common.PropertyGroups.targets.t4" #> - - - - Microsoft Visual C++ 2015 Runtime Package for Windows Universal - - - - - {<#= Properties.ProjectGameGuid #>} - <#= Properties.PackageGameAssemblyName #> - - - - - - - - - Designer - - - - - - - - - - - - - - - - - - 14.0 - - - - diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/App.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/App.cs.t4 deleted file mode 100644 index a889695fa..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/App.cs.t4 +++ /dev/null @@ -1,85 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -using System; -using Windows.ApplicationModel.Activation; -using Windows.ApplicationModel.Core; -using Windows.UI.Core; -using Windows.UI.Popups; -using Windows.UI.ViewManagement; -using Stride.Engine; -using Stride.Games; - -namespace <#= Properties.Namespace #> -{ - class App - { - [MTAThread] - private static void Main() - { - var viewFactory = new FrameworkViewSource(); - CoreApplication.Run(viewFactory); - } - - class FrameworkViewSource : IFrameworkViewSource - { - public IFrameworkView CreateView() - { - var frameworkView = new FrameworkView(); - return frameworkView; - } - } - - class FrameworkView : IFrameworkView - { - Game Game; - CoreWindow m_window; - - public void Initialize(CoreApplicationView applicationView) - { - ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; - applicationView.Activated += OnActivated; - } - - void OnActivated(CoreApplicationView applicationView, IActivatedEventArgs args) - { - CoreWindow.GetForCurrentThread().Activate(); - } - - public void Load(string entryPoint) - { - } - - public void Run() - { - Game = new Game(); - Game.GraphicsDeviceManager.IsFullScreen = true; - Game.UnhandledException += Game_UnhandledException; - - Game.Run(new GameContextUWPCoreWindow(m_window)); - } - - private async void Game_UnhandledException(object sender, GameUnhandledExceptionEventArgs e) - { - // If something went wrong (i.e. GPU feature level is not enough), display an error message instead of crashing to properly pass certifications - var exception = e.ExceptionObject as Exception; - if (exception != null) - { - // Display error message - var messageDialog = new MessageDialog(exception.Message); - await messageDialog.ShowAsync(); - - // Exit application - CoreApplication.Exit(); - } - } - - public void SetWindow(CoreWindow window) - { - m_window = window; - } - - public void Uninitialize() - { - } - } - } -} \ No newline at end of file diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/Package.appxmanifest.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/Package.appxmanifest.t4 deleted file mode 100644 index c4feb3df9..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/Package.appxmanifest.t4 +++ /dev/null @@ -1,15 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - -<#@ include file="..\Package.appxmanifest.common.t4" #> - - - - - \ No newline at end of file diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/ProjectExecutable.UWP.ttproj b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/ProjectExecutable.UWP.ttproj deleted file mode 100644 index 660c421f7..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/CoreWindow/ProjectExecutable.UWP.ttproj +++ /dev/null @@ -1,15 +0,0 @@ -!ProjectTemplate -Files: - - {Source: $ProjectName$.csproj.t4, Target: $ProjectName$.csproj, IsTemplate: true} - - {Source: App.cs.t4, Target: App.cs, IsTemplate: true} - - {Source: Package.appxmanifest.t4, Target: Package.appxmanifest, IsTemplate: true} - - {Source: ..\Properties\AssemblyInfo.cs.t4, Target: Properties\AssemblyInfo.cs, IsTemplate: true} - - {Source: ..\Properties\Default.rd.xml, Target: Properties\Default.rd.xml} - - {Source: ..\Assets\GameIcon150x150.png, Target: Assets\Logo.scale-100.png} - - {Source: ..\Assets\GameIcon300x300.png, Target: Assets\Logo.scale-200.png} - - {Source: ..\Assets\GameSplashScreen620x300.png, Target: Assets\SplashScreen.scale-100.png} - - {Source: ..\Assets\GameSplashScreen1240x600.png, Target: Assets\SplashScreen.scale-200.png} - - {Source: ..\Assets\GameIcon44x44.png, Target: Assets\SmallLogo.scale-100.png} - - {Source: ..\Assets\GameIcon88x88.png, Target: Assets\SmallLogo.scale-200.png} - - {Source: ..\Assets\GameIcon50x50.png, Target: Assets\StoreLogo.scale-100.png} - - {Source: ..\Assets\GameIcon100x100.png, Target: Assets\StoreLogo.scale-200.png} diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Package.appxmanifest.common.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Package.appxmanifest.common.t4 deleted file mode 100644 index 23e527adc..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Package.appxmanifest.common.t4 +++ /dev/null @@ -1,38 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -<# var identityGuid = System.Guid.NewGuid(); #> - - - - - - <#= Properties.PackageGameDisplayName #> - publisher - Assets\StoreLogo.png - - - - - - - - - - - - - - -<#@ include file="..\Common.UWP.targets.t4" #> - - - diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/AssemblyInfo.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/AssemblyInfo.cs.t4 deleted file mode 100644 index 83a866511..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/AssemblyInfo.cs.t4 +++ /dev/null @@ -1,29 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -using System.Reflection; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("<#= Properties.PackageGameName #>")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("<#= Properties.PackageGameName #>")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("en")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/Default.rd.xml b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/Default.rd.xml deleted file mode 100644 index 80a960ce3..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Properties/Default.rd.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.cs.t4 deleted file mode 100644 index 024302954..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.cs.t4 +++ /dev/null @@ -1,56 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Popups; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -using Stride.Engine; -using Stride.Games; - -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 - -namespace <#= Properties.Namespace #> -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class <#= Properties.PackageGameNameShort #>MainPage : Page - { - Game Game; - - public <#= Properties.PackageGameNameShort #>MainPage() - { - this.InitializeComponent(); - - Game = new Game(); - Game.UnhandledException += Game_UnhandledException; - Game.Run(new GameContextUWPXaml(SwapChainPanel)); - } - - private async void Game_UnhandledException(object sender, GameUnhandledExceptionEventArgs e) - { - // If something went wrong (i.e. GPU feature level is not enough), display an error message instead of crashing to properly pass certifications - var exception = e.ExceptionObject as Exception; - if (exception != null) - { - // Display error message - var messageDialog = new MessageDialog(exception.Message); - await messageDialog.ShowAsync(); - - // Exit application - Application.Current.Exit(); - } - } - } -} diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.t4 deleted file mode 100644 index 0cfbc3c75..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$PackageGameNameShort$MainPage.xaml.t4 +++ /dev/null @@ -1,14 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - - - - diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$ProjectName$.csproj.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$ProjectName$.csproj.t4 deleted file mode 100644 index f61ce5f95..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/$ProjectName$.csproj.t4 +++ /dev/null @@ -1,90 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - - - Debug - x86 - {<#= ProjectGuid.ToString().ToUpperInvariant() #>} - AppContainerExe - PackageReference - Properties - <#= Properties.Namespace #> - <#= Properties.PackageName #> - en-US - UAP - 10.0.17134.0 - 10.0.16299.0 - 14 - true - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - <#= ProjectName #>.TemporaryKey.pfx - obj\ - - true - -<#@ include file="..\..\Common.PropertyGroups.targets.t4" #> - - - - Microsoft Visual C++ 2015 Runtime Package for Windows Universal - - - - - {<#= Properties.ProjectGameGuid #>} - <#= Properties.PackageGameAssemblyName #> - - - - - - App.xaml - - - <#= Properties.PackageGameNameShort #>MainPage.xaml - - - - - - Designer - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - 14.0 - - - - diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.cs.t4 deleted file mode 100644 index 5abe318cd..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.cs.t4 +++ /dev/null @@ -1,113 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=402347&clcid=0x409 - -namespace <#= Properties.Namespace #> -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - public sealed partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - this.Suspending += this.OnSuspending; - } - - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used when the application is launched to open a specific file, to display - /// search results, and so forth. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs e) - { -#if DEBUG - if (System.Diagnostics.Debugger.IsAttached) - { - this.DebugSettings.EnableFrameRateCounter = true; - } -#endif - - Frame rootFrame = Window.Current.Content as Frame; - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == null) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - - rootFrame.NavigationFailed += OnNavigationFailed; - - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - // TODO: Load state from previously suspended application - } - - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - if (!rootFrame.Navigate(typeof(<#= Properties.PackageGameNameShort #>MainPage), e.Arguments)) - { - throw new Exception("Failed to create initial page"); - } - } - - // Ensure the current window is active - Window.Current.Activate(); - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - - // TODO: Save application state and stop any background activity - deferral.Complete(); - } - } -} diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.t4 deleted file mode 100644 index 3480c3f36..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/App.xaml.t4 +++ /dev/null @@ -1,9 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/Package.appxmanifest.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/Package.appxmanifest.t4 deleted file mode 100644 index fe77563ae..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/Package.appxmanifest.t4 +++ /dev/null @@ -1,13 +0,0 @@ -<#@ template inherits="ProjectTemplateTransformation" language="C#" #> - - - -<#@ include file="..\Package.appxmanifest.common.t4" #> - - - - \ No newline at end of file diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/ProjectExecutable.UWP.ttproj b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/ProjectExecutable.UWP.ttproj deleted file mode 100644 index 7857b0fc3..000000000 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.UWP/Xaml/ProjectExecutable.UWP.ttproj +++ /dev/null @@ -1,18 +0,0 @@ -!ProjectTemplate -Files: - - {Source: $ProjectName$.csproj.t4, Target: $ProjectName$.csproj, IsTemplate: true} - - {Source: App.xaml.cs.t4, Target: App.xaml.cs, IsTemplate: true} - - {Source: App.xaml.t4, Target: App.xaml, IsTemplate: true} - - {Source: $PackageGameNameShort$MainPage.xaml.cs.t4, Target: $PackageGameNameShort$MainPage.xaml.cs, IsTemplate: true} - - {Source: $PackageGameNameShort$MainPage.xaml.t4, Target: $PackageGameNameShort$MainPage.xaml, IsTemplate: true} - - {Source: Package.appxmanifest.t4, Target: Package.appxmanifest, IsTemplate: true} - - {Source: ..\Properties\AssemblyInfo.cs.t4, Target: Properties\AssemblyInfo.cs, IsTemplate: true} - - {Source: ..\Properties\Default.rd.xml, Target: Properties\Default.rd.xml} - - {Source: ..\Assets\GameIcon150x150.png, Target: Assets\Logo.scale-100.png} - - {Source: ..\Assets\GameIcon300x300.png, Target: Assets\Logo.scale-200.png} - - {Source: ..\Assets\GameSplashScreen620x300.png, Target: Assets\SplashScreen.scale-100.png} - - {Source: ..\Assets\GameSplashScreen1240x600.png, Target: Assets\SplashScreen.scale-200.png} - - {Source: ..\Assets\GameIcon44x44.png, Target: Assets\SmallLogo.scale-100.png} - - {Source: ..\Assets\GameIcon88x88.png, Target: Assets\SmallLogo.scale-200.png} - - {Source: ..\Assets\GameIcon50x50.png, Target: Assets\StoreLogo.scale-100.png} - - {Source: ..\Assets\GameIcon100x100.png, Target: Assets\StoreLogo.scale-200.png} diff --git a/sources/editor/Stride.Assets.Presentation/View/ImageDictionary.xaml b/sources/editor/Stride.Assets.Presentation/View/ImageDictionary.xaml index b25068cec..db8e0a430 100644 --- a/sources/editor/Stride.Assets.Presentation/View/ImageDictionary.xaml +++ b/sources/editor/Stride.Assets.Presentation/View/ImageDictionary.xaml @@ -487,18 +487,6 @@ - - - - - - - - - - - - diff --git a/sources/editor/Stride.Core.Assets.Editor/Resources/Icons/uwp.png b/sources/editor/Stride.Core.Assets.Editor/Resources/Icons/uwp.png deleted file mode 100644 index ed9de30e8..000000000 --- a/sources/editor/Stride.Core.Assets.Editor/Resources/Icons/uwp.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e153c15bff3544be86cc386c2bc964715de579940b3e789cc6b66fbdb1aff525 -size 400 diff --git a/sources/editor/Stride.Core.Assets.Editor/View/ImageDictionary.xaml b/sources/editor/Stride.Core.Assets.Editor/View/ImageDictionary.xaml index 99ee1a427..f6ea2b052 100644 --- a/sources/editor/Stride.Core.Assets.Editor/View/ImageDictionary.xaml +++ b/sources/editor/Stride.Core.Assets.Editor/View/ImageDictionary.xaml @@ -1339,18 +1339,6 @@ - - - - - - - - - - - - diff --git a/sources/engine/Stride.Assets.Tests2/AutoAlphaTests.cs b/sources/engine/Stride.Assets.Tests2/AutoAlphaTests.cs index 3474a88b2..cdb5c54eb 100644 --- a/sources/engine/Stride.Assets.Tests2/AutoAlphaTests.cs +++ b/sources/engine/Stride.Assets.Tests2/AutoAlphaTests.cs @@ -25,11 +25,6 @@ namespace Stride.Assets.Tests2 { Tuple.Create(PlatformType.Windows, AlphaFormat.Explicit), PixelFormat.BC2_UNorm }, { Tuple.Create(PlatformType.Windows, AlphaFormat.Interpolated), PixelFormat.BC3_UNorm }, - { Tuple.Create(PlatformType.UWP, AlphaFormat.None), PixelFormat.BC1_UNorm }, - { Tuple.Create(PlatformType.UWP, AlphaFormat.Mask), PixelFormat.BC1_UNorm }, - { Tuple.Create(PlatformType.UWP, AlphaFormat.Explicit), PixelFormat.BC2_UNorm }, - { Tuple.Create(PlatformType.UWP, AlphaFormat.Interpolated), PixelFormat.BC3_UNorm }, - { Tuple.Create(PlatformType.Android, AlphaFormat.None), PixelFormat.ETC1 }, { Tuple.Create(PlatformType.Android, AlphaFormat.Mask), PixelFormat.ETC2_RGB_A1 }, { Tuple.Create(PlatformType.Android, AlphaFormat.Explicit), PixelFormat.ETC2_RGBA }, diff --git a/sources/engine/Stride.Assets/AssetCompilerContextExtensions.cs b/sources/engine/Stride.Assets/AssetCompilerContextExtensions.cs index 57bb399dd..b42d4a824 100644 --- a/sources/engine/Stride.Assets/AssetCompilerContextExtensions.cs +++ b/sources/engine/Stride.Assets/AssetCompilerContextExtensions.cs @@ -45,7 +45,6 @@ namespace Stride.Assets switch (platformType) { case PlatformType.Windows: - case PlatformType.UWP: return GraphicsPlatform.Direct3D11; case PlatformType.Android: case PlatformType.iOS: diff --git a/sources/engine/Stride.Assets/GameSettingsAsset.cs b/sources/engine/Stride.Assets/GameSettingsAsset.cs index f930c7081..50a79fc8a 100644 --- a/sources/engine/Stride.Assets/GameSettingsAsset.cs +++ b/sources/engine/Stride.Assets/GameSettingsAsset.cs @@ -143,9 +143,6 @@ namespace Stride.Assets case PlatformType.iOS: configPlatform = ConfigPlatforms.iOS; break; - case PlatformType.UWP: - configPlatform = ConfigPlatforms.UWP; - break; case PlatformType.Linux: configPlatform = ConfigPlatforms.Linux; break; diff --git a/sources/engine/Stride.Assets/StrideConfig.cs b/sources/engine/Stride.Assets/StrideConfig.cs index 3facc0b65..0858f9c4a 100644 --- a/sources/engine/Stride.Assets/StrideConfig.cs +++ b/sources/engine/Stride.Assets/StrideConfig.cs @@ -35,12 +35,6 @@ namespace Stride.Assets { VS2015Version, @"MSBuild\Xamarin\Android\Xamarin.Android.CSharp.targets" } }; - internal static readonly Dictionary UniversalWindowsPlatformComponents = new Dictionary - { - { VSAnyVersion, @"Microsoft.VisualStudio.Component.UWP.Support" }, - { VS2015Version, @"MSBuild\Microsoft\WindowsXaml\v14.0\8.2\Microsoft.Windows.UI.Xaml.Common.Targets" } - }; - public static PackageDependency GetLatestPackageDependency() { return new PackageDependency(PackageName, new PackageVersionRange() @@ -68,53 +62,6 @@ namespace Stride.Assets }; solutionPlatforms.Add(windowsPlatform); - // Universal Windows Platform (UWP) - var uwpPlatform = new SolutionPlatform() - { - Name = PlatformType.UWP.ToString(), - Type = PlatformType.UWP, - TargetFramework = "uap10.0.16299", - Templates = - { - //new SolutionPlatformTemplate("ProjectExecutable.UWP/CoreWindow/ProjectExecutable.UWP.ttproj", "Core Window"), - new SolutionPlatformTemplate("ProjectExecutable.UWP/Xaml/ProjectExecutable.UWP.ttproj", "Xaml") - }, - IsAvailable = IsVSComponentAvailableAnyVersion(UniversalWindowsPlatformComponents), - UseWithExecutables = false, - IncludeInSolution = false, - }; - - uwpPlatform.DefineConstants.Add("STRIDE_PLATFORM_UWP"); - uwpPlatform.Configurations.Add(new SolutionConfiguration("Testing")); - uwpPlatform.Configurations.Add(new SolutionConfiguration("AppStore")); - uwpPlatform.Configurations["Release"].Properties.Add(";2008"); - uwpPlatform.Configurations["Debug"].Properties.Add(";2008"); - uwpPlatform.Configurations["Testing"].Properties.Add(";2008"); - uwpPlatform.Configurations["AppStore"].Properties.Add(";2008"); - - uwpPlatform.Configurations["Release"].Properties.Add("true"); - uwpPlatform.Configurations["Testing"].Properties.Add("true"); - uwpPlatform.Configurations["AppStore"].Properties.Add("true"); - - foreach (var cpu in new[] { "x86", "x64", "ARM" }) - { - var uwpPlatformCpu = new SolutionPlatformPart(uwpPlatform.Name + "-" + cpu) - { - LibraryProjectName = uwpPlatform.Name, - ExecutableProjectName = cpu, - Cpu = cpu, - InheritConfigurations = true, - UseWithLibraries = false, - UseWithExecutables = true, - }; - uwpPlatformCpu.Configurations.Clear(); - uwpPlatformCpu.Configurations.AddRange(uwpPlatform.Configurations); - - uwpPlatform.PlatformsPart.Add(uwpPlatformCpu); - } - - solutionPlatforms.Add(uwpPlatform); - // Linux var linuxPlatform = new SolutionPlatform() { diff --git a/sources/engine/Stride.Assets/Textures/TextureHelper.cs b/sources/engine/Stride.Assets/Textures/TextureHelper.cs index e4b3e1ef4..c03ac4c5f 100644 --- a/sources/engine/Stride.Assets/Textures/TextureHelper.cs +++ b/sources/engine/Stride.Assets/Textures/TextureHelper.cs @@ -250,7 +250,6 @@ namespace Stride.Assets.Textures } break; case PlatformType.Windows: - case PlatformType.UWP: case PlatformType.Linux: case PlatformType.macOS: switch (parameters.GraphicsPlatform) diff --git a/sources/engine/Stride.Audio/Native/XAudio2.cpp b/sources/engine/Stride.Audio/Native/XAudio2.cpp index 0bef03ce2..eb51c0815 100644 --- a/sources/engine/Stride.Audio/Native/XAudio2.cpp +++ b/sources/engine/Stride.Audio/Native/XAudio2.cpp @@ -3,7 +3,7 @@ #include "Common.h" -#if defined(WINDOWS_DESKTOP) || defined(UWP) || defined(WINDOWS_STORE) || defined(WINDOWS_PHONE) || !defined(__clang__) +#if defined(WINDOWS_DESKTOP) || defined(WINDOWS_STORE) || !defined(__clang__) #include "../../../deps/NativePath/NativePath.h" #include "../../../deps/NativePath/NativeThreading.h" diff --git a/sources/engine/Stride.Audio/Stride.Native.Libs.targets b/sources/engine/Stride.Audio/Stride.Native.Libs.targets index 5152282c6..9d98d3296 100644 --- a/sources/engine/Stride.Audio/Stride.Native.Libs.targets +++ b/sources/engine/Stride.Audio/Stride.Native.Libs.targets @@ -1,7 +1,6 @@ libCompilerRt.lib libCelt.lib - libCompilerRt.lib libCelt.lib Xaudio2.lib diff --git a/sources/engine/Stride.Engine/Engine/Network/RouterClient.cs b/sources/engine/Stride.Engine/Engine/Network/RouterClient.cs index 0bddb1a1e..be4da3792 100644 --- a/sources/engine/Stride.Engine/Engine/Network/RouterClient.cs +++ b/sources/engine/Stride.Engine/Engine/Network/RouterClient.cs @@ -141,8 +141,6 @@ namespace Stride.Engine.Network { switch (Platform.Type) { - case PlatformType.UWP: - return RouterConnectionMode.ConnectThenListen; case PlatformType.Android: case PlatformType.iOS: return RouterConnectionMode.Listen; @@ -166,7 +164,7 @@ namespace Stride.Engine.Network /// /// First, tries to connect, and if not possible, listen for a router connection. - /// This is useful for platform where we can't be sure (no way to determine if emulator and/or run in desktop or remotely, such as UWP). + /// This is useful for platform where we can't be sure (no way to determine if emulator and/or run in desktop or remotely). /// ConnectThenListen = 3, } diff --git a/sources/engine/Stride.Games.Testing/GameTestingClient.cs b/sources/engine/Stride.Games.Testing/GameTestingClient.cs index 9178689d0..e04481567 100644 --- a/sources/engine/Stride.Games.Testing/GameTestingClient.cs +++ b/sources/engine/Stride.Games.Testing/GameTestingClient.cs @@ -48,9 +48,6 @@ namespace Stride.Games.Testing case PlatformType.iOS: platformName = "iOS"; break; - case PlatformType.UWP: - platformName = "UWP"; - break; default: platformName = ""; break; diff --git a/sources/engine/Stride.Games/GameContext.cs b/sources/engine/Stride.Games/GameContext.cs index 8e2338269..0073daf75 100644 --- a/sources/engine/Stride.Games/GameContext.cs +++ b/sources/engine/Stride.Games/GameContext.cs @@ -102,13 +102,9 @@ namespace Stride.Games { get { -#if STRIDE_PLATFORM_UWP - return "Stride Game"; -#else var assembly = Assembly.GetEntryAssembly(); var productAttribute = assembly?.GetCustomAttribute(); return productAttribute?.Product ?? "Stride Game"; -#endif } } @@ -120,11 +116,7 @@ namespace Stride.Games { get { -#if STRIDE_PLATFORM_UWP - return string.Empty; -#else return PlatformFolders.ApplicationExecutablePath ?? string.Empty; -#endif } } diff --git a/sources/engine/Stride.Games/GameContextFactory.cs b/sources/engine/Stride.Games/GameContextFactory.cs index 95b0a2f8f..9b09190c4 100644 --- a/sources/engine/Stride.Games/GameContextFactory.cs +++ b/sources/engine/Stride.Games/GameContextFactory.cs @@ -32,12 +32,6 @@ namespace Stride.Games case AppContextType.DesktopWpf: res = NewGameContextWpf(requestedWidth, requestedHeight, isUserManagingRun); break; - case AppContextType.UWPXaml: - res = NewGameContextUWPXaml(requestedWidth, requestedHeight); - break; - case AppContextType.UWPCoreWindow: - res = NewGameContextUWPCoreWindow(requestedWidth, requestedHeight); - break; case AppContextType.iOS: res = NewGameContextiOS(); break; @@ -82,24 +76,6 @@ namespace Stride.Games #endif } - public static GameContext NewGameContextUWPXaml(int requestedWidth = 0, int requestedHeight = 0) - { -#if STRIDE_PLATFORM_UWP - return new GameContextUWPXaml(null, requestedWidth, requestedHeight); -#else - return null; -#endif - } - - public static GameContext NewGameContextUWPCoreWindow(int requestedWidth = 0, int requestedHeight = 0) - { -#if STRIDE_PLATFORM_UWP - return new GameContextUWPCoreWindow(null, requestedWidth, requestedHeight); -#else - return null; -#endif - } - public static GameContext NewGameContextSDL(int requestedWidth = 0, int requestedHeight = 0, bool isUserManagingRun = false) { #if STRIDE_UI_SDL diff --git a/sources/engine/Stride.Games/GameContextUWP.cs b/sources/engine/Stride.Games/GameContextUWP.cs deleted file mode 100644 index abb01acce..000000000 --- a/sources/engine/Stride.Games/GameContextUWP.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -// -// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -#if STRIDE_PLATFORM_UWP -using Windows.UI.Core; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; - -namespace Stride.Games -{ - public class GameContextUWPXaml : GameContext - { - // Used internally by systems such as UI to capture input in a TextBox - internal TextBox EditTextBox = new TextBox { VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(10, 0, 10, 0)}; - - /// - public GameContextUWPXaml(SwapChainPanel control, int requestedWidth = 0, int requestedHeight = 0) - : base (control ?? new SwapChainPanel(), requestedWidth, requestedHeight) - { - ContextType = AppContextType.UWPXaml; - } - } - - public class GameContextUWPCoreWindow : GameContext - { - /// - public GameContextUWPCoreWindow(CoreWindow control, int requestedWidth = 0, int requestedHeight = 0, bool isWindowsMixedReality = false) - : base(control ?? CoreWindow.GetForCurrentThread(), requestedWidth, requestedHeight) - { - ContextType = AppContextType.UWPCoreWindow; - IsWindowsMixedReality = isWindowsMixedReality; - } - - internal bool IsWindowsMixedReality { get; } - } -} -#endif diff --git a/sources/engine/Stride.Games/GamePlatform.cs b/sources/engine/Stride.Games/GamePlatform.cs index 36848ae43..7d0f440bf 100644 --- a/sources/engine/Stride.Games/GamePlatform.cs +++ b/sources/engine/Stride.Games/GamePlatform.cs @@ -50,9 +50,7 @@ namespace Stride.Games public static GamePlatform Create(GameBase game) { -#if STRIDE_PLATFORM_UWP - return new GamePlatformUWP(game); -#elif STRIDE_PLATFORM_ANDROID +#if STRIDE_PLATFORM_ANDROID return new GamePlatformAndroid(game); #elif STRIDE_PLATFORM_IOS return new GamePlatformiOS(game); @@ -331,19 +329,8 @@ namespace Stride.Games { var graphicsDevice = GraphicsDevice.New(deviceInformation.Adapter, deviceInformation.DeviceCreationFlags, gameWindow.NativeWindow, deviceInformation.GraphicsProfile); graphicsDevice.ColorSpace = deviceInformation.PresentationParameters.ColorSpace; - -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP - if (game.Context is GameContextUWPCoreWindow context && context.IsWindowsMixedReality) - { - graphicsDevice.Recreate(deviceInformation.Adapter, new[] { deviceInformation.GraphicsProfile }, deviceInformation.DeviceCreationFlags |= DeviceCreationFlags.BgraSupport, gameWindow.NativeWindow); - graphicsDevice.Presenter = new WindowsMixedRealityGraphicsPresenter(graphicsDevice, deviceInformation.PresentationParameters); - } - else -#endif - { - graphicsDevice.Presenter = new SwapChainGraphicsPresenter(graphicsDevice, deviceInformation.PresentationParameters); - } - + graphicsDevice.Presenter = new SwapChainGraphicsPresenter(graphicsDevice, deviceInformation.PresentationParameters); + return graphicsDevice; } diff --git a/sources/engine/Stride.Games/GameWindowRenderer.cs b/sources/engine/Stride.Games/GameWindowRenderer.cs index aca93baf2..ce48dbb20 100644 --- a/sources/engine/Stride.Games/GameWindowRenderer.cs +++ b/sources/engine/Stride.Games/GameWindowRenderer.cs @@ -191,18 +191,8 @@ namespace Stride.Games var size = GetRequestedSize(out resizeFormat); var presentationParameters = new PresentationParameters((int)size.X, (int)size.Y, Window.NativeWindow, resizeFormat) { DepthStencilFormat = PreferredDepthStencilFormat }; presentationParameters.PresentationInterval = PresentInterval.Immediate; - -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP - if (Game.Context is GameContextUWPCoreWindow context && context.IsWindowsMixedReality) - { - Presenter = new WindowsMixedRealityGraphicsPresenter(GraphicsDevice, presentationParameters); - } - else -#endif - { - Presenter = new SwapChainGraphicsPresenter(GraphicsDevice, presentationParameters); - } - + + Presenter = new SwapChainGraphicsPresenter(GraphicsDevice, presentationParameters); isBackBufferToResize = false; } } diff --git a/sources/engine/Stride.Games/WindowsStore/GamePlatformUWP.cs b/sources/engine/Stride.Games/WindowsStore/GamePlatformUWP.cs deleted file mode 100644 index 466ac7fc1..000000000 --- a/sources/engine/Stride.Games/WindowsStore/GamePlatformUWP.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -// -// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -#if STRIDE_PLATFORM_UWP -using System; -using System.Collections.Generic; - -using Stride.Graphics; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Core; - -namespace Stride.Games -{ - internal class GamePlatformUWP : GamePlatform - { - public GamePlatformUWP(GameBase game) : base(game) - { - // Application lifecycle reference: - // https://docs.microsoft.com/en-us/windows/uwp/launch-resume/app-lifecycle - // https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication - - CoreApplication.Suspending += CurrentOnSuspending; - CoreApplication.Resuming += CurrentOnResuming; - } - - private void CurrentOnResuming(object sender, object o) - { - OnResume(sender, null); - } - - private void CurrentOnSuspending(object sender, SuspendingEventArgs suspendingEventArgs) - { - var deferral = suspendingEventArgs.SuspendingOperation.GetDeferral(); - - using (var device3 = game.GraphicsDevice.NativeDevice.QueryInterface()) - { - game.GraphicsContext.CommandList.ClearState(); - device3.Trim(); - } - - OnSuspend(sender, null); - - deferral.Complete(); - } - - public override string DefaultAppDirectory - { - get - { - return Package.Current.InstalledLocation.Path; - } - } - - internal override GameWindow GetSupportedGameWindow(AppContextType type) - { - if (type == AppContextType.UWPCoreWindow || type == AppContextType.UWPXaml) - { - return new GameWindowUWP(); - } - else - { - return null; - } - } - - public override List FindBestDevices(GameGraphicsParameters preferredParameters) - { - var graphicsDeviceInfos = base.FindBestDevices(preferredParameters); - - // Special case where the default FindBestDevices is not working - if (graphicsDeviceInfos.Count == 0) - { - var graphicsAdapter = GraphicsAdapterFactory.Adapters[0]; - - // Iterate on each preferred graphics profile - foreach (var featureLevel in preferredParameters.PreferredGraphicsProfile) - { - // Check if this profile is supported. - if (graphicsAdapter.IsProfileSupported(featureLevel)) - { - var deviceInfo = new GraphicsDeviceInformation - { - Adapter = graphicsAdapter, - GraphicsProfile = featureLevel, - PresentationParameters = - { - MultisampleCount = preferredParameters.PreferredMultisampleCount, - IsFullScreen = preferredParameters.IsFullScreen, - PresentationInterval = preferredParameters.SynchronizeWithVerticalRetrace ? PresentInterval.One : PresentInterval.Immediate, - DeviceWindowHandle = MainWindow.NativeWindow, - } - }; - - // Hardcoded format and refresh rate... - // This is a workaround to allow this code to work inside the emulator - // but this is not really robust - // TODO: Check how to handle this case properly - var displayMode = new DisplayMode(PixelFormat.B8G8R8A8_UNorm, gameWindow.ClientBounds.Width, gameWindow.ClientBounds.Height, new Rational(60, 1)); - AddDevice(displayMode, deviceInfo, preferredParameters, graphicsDeviceInfos); - - // If the profile is supported, we are just using the first best one - break; - } - } - } - - return graphicsDeviceInfos; - } - } -} -#endif diff --git a/sources/engine/Stride.Games/WindowsStore/GameWindowUWP.cs b/sources/engine/Stride.Games/WindowsStore/GameWindowUWP.cs deleted file mode 100644 index 17df894af..000000000 --- a/sources/engine/Stride.Games/WindowsStore/GameWindowUWP.cs +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -// -// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -#if STRIDE_PLATFORM_UWP - -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using Windows.Graphics.Display; -using Stride.Graphics; -using Stride.Core.Mathematics; -using Windows.Foundation; -using Windows.UI.ViewManagement; -using Windows.UI.Core; -using Windows.UI.Xaml; -//using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Media; - -namespace Stride.Games -{ - /// - /// implementation for UWP. Handles both and . - /// - internal class GameWindowUWP : GameWindow - { -#region Fields - private const DisplayOrientations PortraitOrientations = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped; - private const DisplayOrientations LandscapeOrientations = DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped; - - private WindowHandle windowHandle; - private int currentWidth; - private int currentHeight; - - private SwapChainPanel swapChainPanel = null; - private CoreWindow coreWindow = null; - - private static readonly Windows.Devices.Input.MouseCapabilities mouseCapabilities = new Windows.Devices.Input.MouseCapabilities(); - - private DispatcherTimer resizeTimer = null; - - private double requiredRatio; - private ApplicationView applicationView; - private bool canResize; - - private bool visible; - private bool focused; -#endregion - -#region Public Properties - - public override bool AllowUserResizing - { - get - { - return true; - } - set - { - } - } - - public override Rectangle ClientBounds - { - get - { - if (swapChainPanel != null) - { - return new Rectangle(0, 0, - (int)(swapChainPanel.ActualWidth * swapChainPanel.CompositionScaleX + 0.5f), - (int)(swapChainPanel.ActualHeight * swapChainPanel.CompositionScaleY + 0.5f)); - - } - - if (coreWindow != null) - { - return new Rectangle((int)(coreWindow.Bounds.X), (int)(coreWindow.Bounds.Y), (int)(coreWindow.Bounds.Width), (int)(coreWindow.Bounds.Height)); - } - - throw new ArgumentException($"{nameof(GameWindow)} should have either a {nameof(SwapChainPanel)} or a {nameof(CoreWindow)}"); - } - } - - public override DisplayOrientation CurrentOrientation => DisplayOrientation.Default; - - public override bool IsMinimized => false; - - public override bool Focused => focused; - - private bool isMouseVisible; - private CoreCursor cursor; - - public override bool IsMouseVisible - { - get - { - return isMouseVisible; - } - set - { - if (isMouseVisible == value) - return; - - if (mouseCapabilities.MousePresent == 0) - return; - - if (value) - { - if (cursor != null) - { - coreWindow.PointerCursor = cursor; - } - - isMouseVisible = true; - } - else - { - if (coreWindow.PointerCursor != null) - { - cursor = coreWindow.PointerCursor; - } - - //yep thats how you hide the cursor under WinRT api... - coreWindow.PointerCursor = null; - isMouseVisible = false; - } - } - } - - public override WindowHandle NativeWindow - { - get - { - return windowHandle; - } - } - - /// - /// Gets or sets a value indicating whether this is visible. - /// - /// true if visible; otherwise, false. - public override bool Visible - { - get - { - return visible; - } - set - { - } - } - - /// - public override bool IsBorderLess - { - get - { - return true; - } - set - { - } - } - -#endregion - -#region Public Methods and Operators - - public override void BeginScreenDeviceChange(bool willBeFullScreen) - { - } - - public override void EndScreenDeviceChange(int clientWidth, int clientHeight) - { - } - -#endregion - -#region Methods - - protected internal override void Initialize(GameContext windowContext) - { - swapChainPanel = (windowContext as GameContextUWPXaml)?.Control; - coreWindow = (windowContext as GameContextUWPCoreWindow)?.Control; - - if (swapChainPanel != null) - { - resizeTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; - resizeTimer.Tick += ResizeTimerOnTick; - - coreWindow = CoreWindow.GetForCurrentThread(); - windowHandle = new WindowHandle(AppContextType.UWPXaml, swapChainPanel, IntPtr.Zero); - } - else if (coreWindow != null) - { - coreWindow.SizeChanged += ResizeOnWindowChange; - windowHandle = new WindowHandle(AppContextType.UWPCoreWindow, coreWindow, IntPtr.Zero); - } - else - { - Debug.Assert(swapChainPanel == null && coreWindow == null, "GameContext was neither UWPXaml nor UWPCoreWindow"); - } - - applicationView = ApplicationView.GetForCurrentView(); - if (applicationView != null && windowContext.RequestedWidth != 0 && windowContext.RequestedHeight != 0) - { - applicationView.SetPreferredMinSize(new Size(windowContext.RequestedWidth, windowContext.RequestedHeight)); - canResize = applicationView.TryResizeView(new Size(windowContext.RequestedWidth, windowContext.RequestedHeight)); - } - - requiredRatio = windowContext.RequestedWidth/(double)windowContext.RequestedHeight; - - if (swapChainPanel != null) - { - swapChainPanel.SizeChanged += swapChainPanel_SizeChanged; - swapChainPanel.CompositionScaleChanged += swapChainPanel_CompositionScaleChanged; - } - - coreWindow.SizeChanged += CurrentWindowOnSizeChanged; - - visible = coreWindow.Visible; - coreWindow.VisibilityChanged += CurrentWindowOnVisibilityChanged; - coreWindow.Activated += CurrentWindowOnActivated; - } - - private void CurrentWindowOnSizeChanged(object sender, WindowSizeChangedEventArgs windowSizeChangedEventArgs) - { - var newBounds = windowSizeChangedEventArgs.Size; - HandleSizeChanged(sender, newBounds); - } - - private void CurrentWindowOnVisibilityChanged( CoreWindow window, VisibilityChangedEventArgs args ) - { - visible = args.Visible; - } - - private void CurrentWindowOnActivated(CoreWindow window, WindowActivatedEventArgs args) - { - switch( args.WindowActivationState ) - { - case CoreWindowActivationState.PointerActivated: - case CoreWindowActivationState.CodeActivated: - focused = true; - break; - case CoreWindowActivationState.Deactivated: - focused = false; - break; - default: - focused = true; - Debug.WriteLine( $"{nameof(args.WindowActivationState)} '{args.WindowActivationState}' not implemented for {nameof(GameWindowUWP)} in {nameof(CurrentWindowOnActivated)}" ); - break; - } - } - - void swapChainPanel_CompositionScaleChanged(SwapChainPanel sender, object args) - { - OnClientSizeChanged(sender, EventArgs.Empty); - } - - private void ResizeTimerOnTick(object sender, object o) - { - resizeTimer.Stop(); - OnClientSizeChanged(sender, EventArgs.Empty); - } - - private void ResizeOnWindowChange(object sender, object o) - { - OnClientSizeChanged(sender, EventArgs.Empty); - } - - private void HandleSizeChanged(object sender, Size newSize) - { - var bounds = newSize; - - // Only supports swapChainPanel for now - if (swapChainPanel != null && bounds.Width > 0 && bounds.Height > 0 && currentWidth > 0 && currentHeight > 0) - { - double panelWidth; - double panelHeight; - panelWidth = bounds.Width; - panelHeight = bounds.Height; - - if (canResize) - { - if (swapChainPanel.Width != panelWidth || swapChainPanel.Height != panelHeight) - { - // Center the panel - swapChainPanel.HorizontalAlignment = HorizontalAlignment.Center; - swapChainPanel.VerticalAlignment = VerticalAlignment.Center; - - swapChainPanel.Width = panelWidth; - swapChainPanel.Height = panelHeight; - } - } - else - { - //mobile device, keep aspect fine - var aspect = panelWidth / panelHeight; - if (aspect < requiredRatio) - { - panelWidth = bounds.Width; //real screen width - panelHeight = panelWidth / requiredRatio; - } - else - { - panelHeight = bounds.Height; - panelWidth = panelHeight * requiredRatio; - } - - if (swapChainPanel.Width != panelWidth || swapChainPanel.Height != panelHeight) - { - // Center the panel - swapChainPanel.HorizontalAlignment = HorizontalAlignment.Center; - swapChainPanel.VerticalAlignment = VerticalAlignment.Center; - - swapChainPanel.Width = panelWidth; - swapChainPanel.Height = panelHeight; - } - } - } - - if (resizeTimer != null) - { - resizeTimer.Stop(); - resizeTimer.Start(); - } - } - - private void swapChainPanel_SizeChanged(object sender, SizeChangedEventArgs e) - { - var bounds = e.NewSize; - HandleSizeChanged(sender, bounds); - if (resizeTimer != null) - { - resizeTimer.Stop(); - resizeTimer.Start(); - } - } - - internal override void Resize(int width, int height) - { - currentWidth = width; - currentHeight = height; - } - - void CompositionTarget_Rendering(object sender, object e) - { - // Call InitCallback only first time - if (InitCallback != null) - { - InitCallback(); - InitCallback = null; - } - - RunCallback(); - } - - internal override void Run() - { - if (swapChainPanel != null) - { - CompositionTarget.Rendering += CompositionTarget_Rendering; - return; - } - - // Call InitCallback only first time - if (InitCallback != null) - { - InitCallback(); - InitCallback = null; - } - - try - { - while (true) - { - coreWindow.Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessAllIfPresent); - if (Exiting) - { - Destroy(); - break; - } - - RunCallback(); - } - } - finally - { - ExitCallback?.Invoke(); - } - } - - protected internal override void SetSupportedOrientations(DisplayOrientation orientations) - { - // Desktop doesn't have orientation (unless on Windows 8?) - } - - protected override void SetTitle(string title) - { - - } - - protected override void Destroy() - { - if (swapChainPanel != null) - { - CompositionTarget.Rendering -= CompositionTarget_Rendering; - } - base.Destroy(); - } -#endregion - } -} - -#endif diff --git a/sources/engine/Stride.Graphics.Regression/GameTester.cs b/sources/engine/Stride.Graphics.Regression/GameTester.cs index 6bca1baea..9708e0d6c 100644 --- a/sources/engine/Stride.Graphics.Regression/GameTester.cs +++ b/sources/engine/Stride.Graphics.Regression/GameTester.cs @@ -29,10 +29,6 @@ namespace Stride.Graphics.Regression game.Run(); } -#elif STRIDE_PLATFORM_UWP - - throw new NotImplementedException(); - #elif STRIDE_PLATFORM_IOS || STRIDE_PLATFORM_ANDROID lock(uniThreadLock) diff --git a/sources/engine/Stride.Graphics.Regression/RegressionHelpers.cs b/sources/engine/Stride.Graphics.Regression/RegressionHelpers.cs index 3776b705e..dae06025b 100644 --- a/sources/engine/Stride.Graphics.Regression/RegressionHelpers.cs +++ b/sources/engine/Stride.Graphics.Regression/RegressionHelpers.cs @@ -1,21 +1,8 @@ // Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.IO.Compression; -using System.Runtime.InteropServices; -using System.Text; using Stride.Core; -using Stride.Core.LZ4; - -#if STRIDE_PLATFORM_UWP -using Windows.Security.Cryptography; -using Windows.Security.Cryptography.Core; -using Windows.System.Profile; -using Windows.Security.ExchangeActiveSyncProvisioning; -#endif namespace Stride.Graphics.Regression { @@ -68,18 +55,6 @@ namespace Stride.Graphics.Regression result.Platform = "iOS"; result.DeviceName = iOSDeviceType.Version.ToString(); result.Serial = UIKit.UIDevice.CurrentDevice.Name; -#elif STRIDE_PLATFORM_UWP - result.Platform = "UWP"; - var deviceInfo = new EasClientDeviceInformation(); - result.DeviceName = deviceInfo.SystemManufacturer + " " + deviceInfo.SystemProductName; - try - { - result.Serial = deviceInfo.Id.ToString(); - } - catch (Exception) - { - // Ignored on UWP - } #endif return result; diff --git a/sources/engine/Stride.Graphics.Regression/Stride.Graphics.Regression.csproj b/sources/engine/Stride.Graphics.Regression/Stride.Graphics.Regression.csproj index 3d6a3049d..6b178886d 100644 --- a/sources/engine/Stride.Graphics.Regression/Stride.Graphics.Regression.csproj +++ b/sources/engine/Stride.Graphics.Regression/Stride.Graphics.Regression.csproj @@ -5,7 +5,7 @@ - Windows;Android;iOS;Linux;macOS;UWP + Windows;Android;iOS;Linux;macOS $(DefineConstants);XAMCORE_2_0 true true diff --git a/sources/engine/Stride.Graphics/AppContextType.cs b/sources/engine/Stride.Graphics/AppContextType.cs index a767ba508..5ba37d5bb 100644 --- a/sources/engine/Stride.Graphics/AppContextType.cs +++ b/sources/engine/Stride.Graphics/AppContextType.cs @@ -48,16 +48,6 @@ namespace Stride.Games /// Android, - /// - /// Game running on UWP in a Xaml SwapChainPanel. - /// - UWPXaml, - - /// - /// Game running on UWP in a CoreWindow. - /// - UWPCoreWindow, - #pragma warning disable SA1300 // Element must begin with upper-case letter /// /// Game running on iOS in a iPhoneOSGameView. diff --git a/sources/engine/Stride.Graphics/Direct3D/GraphicsAdapterFactory.Direct3D.cs b/sources/engine/Stride.Graphics/Direct3D/GraphicsAdapterFactory.Direct3D.cs index 9eba9d5cd..2b9756aa6 100644 --- a/sources/engine/Stride.Graphics/Direct3D/GraphicsAdapterFactory.Direct3D.cs +++ b/sources/engine/Stride.Graphics/Direct3D/GraphicsAdapterFactory.Direct3D.cs @@ -8,7 +8,7 @@ namespace Stride.Graphics { public static partial class GraphicsAdapterFactory { -#if STRIDE_PLATFORM_UWP || DIRECTX11_1 +#if DIRECTX11_1 internal static Factory2 NativeFactory; #else internal static Factory1 NativeFactory; @@ -24,9 +24,6 @@ namespace Stride.Graphics #if DIRECTX11_1 using (var factory = new Factory1()) NativeFactory = factory.QueryInterface(); -#elif STRIDE_PLATFORM_UWP - // Maybe this will become default code for everybody if we switch to DX 11.1/11.2 SharpDX dll? - NativeFactory = new Factory2(); #else NativeFactory = new Factory1(); #endif diff --git a/sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs b/sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs index 4e345cc85..fbef6f49e 100644 --- a/sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs +++ b/sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs @@ -122,16 +122,11 @@ namespace Stride.Graphics { get { -#if STRIDE_PLATFORM_UWP - return false; -#else return swapChain.IsFullScreen; -#endif } set { -#if !STRIDE_PLATFORM_UWP if (swapChain == null) return; @@ -184,7 +179,6 @@ namespace Stride.Graphics description.RefreshRate = new SharpDX.DXGI.Rational(0, 0); swapChain.ResizeTarget(ref description); } -#endif } } @@ -269,19 +263,6 @@ namespace Stride.Graphics // Manually update all children textures var fastList = DestroyChildrenTextures(backBuffer); -#if STRIDE_PLATFORM_UWP - var swapChainPanel = Description.DeviceWindowHandle.NativeWindow as Windows.UI.Xaml.Controls.SwapChainPanel; - if (swapChainPanel != null) - { - var swapChain2 = swapChain.QueryInterface(); - if (swapChain2 != null) - { - swapChain2.MatrixTransform = new RawMatrix3x2 { M11 = 1f / swapChainPanel.CompositionScaleX, M22 = 1f / swapChainPanel.CompositionScaleY }; - swapChain2.Dispose(); - } - } -#endif - if (useFlipModel) format = ToSupportedFlipModelFormat(format); // See CreateSwapChainForDesktop @@ -356,78 +337,10 @@ namespace Stride.Graphics { throw new ArgumentException("DeviceWindowHandle cannot be null"); } - -#if STRIDE_PLATFORM_UWP - return CreateSwapChainForUWP(); -#else + return CreateSwapChainForWindows(); -#endif } -#if STRIDE_PLATFORM_UWP - private SwapChain CreateSwapChainForUWP() - { - bufferCount = 2; - var description = new SwapChainDescription1 - { - // Automatic sizing - Width = Description.BackBufferWidth, - Height = Description.BackBufferHeight, - Format = (DXGI_Format)Description.BackBufferFormat.ToNonSRgb(), - Stereo = false, - SampleDescription = new SharpDX.DXGI.SampleDescription((int)Description.MultisampleCount, 0), - Usage = Usage.BackBuffer | Usage.RenderTargetOutput, - // Use two buffers to enable flip effect. - BufferCount = bufferCount, - Scaling = SharpDX.DXGI.Scaling.Stretch, - SwapEffect = SharpDX.DXGI.SwapEffect.FlipSequential, - }; - - SwapChain swapChain = null; - switch (Description.DeviceWindowHandle.Context) - { - case Games.AppContextType.UWPXaml: - { - var nativePanel = ComObject.As(Description.DeviceWindowHandle.NativeWindow); - - // Creates the swap chain for XAML composition - swapChain = new SwapChain1(GraphicsAdapterFactory.NativeFactory, GraphicsDevice.NativeDevice, ref description); - - // Associate the SwapChainPanel with the swap chain - nativePanel.SwapChain = swapChain; - - break; - } - - case Games.AppContextType.UWPCoreWindow: - { - using (var dxgiDevice = GraphicsDevice.NativeDevice.QueryInterface()) - { - // Ensure that DXGI does not queue more than one frame at a time. This both reduces - // latency and ensures that the application will only render after each VSync, minimizing - // power consumption. - dxgiDevice.MaximumFrameLatency = 1; - - // Next, get the parent factory from the DXGI Device. - using (var dxgiAdapter = dxgiDevice.Adapter) - using (var dxgiFactory = dxgiAdapter.GetParent()) - // Finally, create the swap chain. - using (var coreWindow = new SharpDX.ComObject(Description.DeviceWindowHandle.NativeWindow)) - { - swapChain = new SharpDX.DXGI.SwapChain1(dxgiFactory - , GraphicsDevice.NativeDevice, coreWindow, ref description); - } - } - - break; - } - default: - throw new NotSupportedException(string.Format("Window context [{0}] not supported while creating SwapChain", Description.DeviceWindowHandle.Context)); - } - - return swapChain; - } -#else /// /// Create the SwapChain on Windows. /// @@ -509,7 +422,6 @@ namespace Stride.Graphics return flags; } -#endif /// /// Flip model does not support certain format, this method ensures it is in a supported format. diff --git a/sources/engine/Stride.Graphics/Stride.Graphics.csproj b/sources/engine/Stride.Graphics/Stride.Graphics.csproj index c6495f24b..136e78397 100644 --- a/sources/engine/Stride.Graphics/Stride.Graphics.csproj +++ b/sources/engine/Stride.Graphics/Stride.Graphics.csproj @@ -44,9 +44,9 @@ - + - + diff --git a/sources/engine/Stride.Graphics/WindowsMixedReality/WindowsMixedRealityGraphicsPresenter.cs b/sources/engine/Stride.Graphics/WindowsMixedReality/WindowsMixedRealityGraphicsPresenter.cs deleted file mode 100644 index 171d1fcb4..000000000 --- a/sources/engine/Stride.Graphics/WindowsMixedReality/WindowsMixedRealityGraphicsPresenter.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP - -using System; -using System.Runtime.InteropServices; -using SharpDX.Direct3D11; -using Windows.Graphics.DirectX.Direct3D11; -using Windows.Graphics.Holographic; -using Windows.UI.Core; - -namespace Stride.Graphics -{ - public class WindowsMixedRealityGraphicsPresenter : GraphicsPresenter - { - private static readonly Guid ID3D11Resource = new Guid("DC8E63F3-D12B-4952-B47B-5E45026A862D"); - - private readonly HolographicSpace holographicSpace; - private Texture backBuffer; - - public WindowsMixedRealityGraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) - : base(device, presentationParameters) - { - holographicSpace = HolographicSpace.CreateForCoreWindow(CoreWindow.GetForCurrentThread()); - CoreWindow.GetForCurrentThread().Activate(); - - Device3 d3DDevice = device.NativeDevice.QueryInterface(); - IDirect3DDevice d3DInteropDevice = null; - - // Acquire the DXGI interface for the Direct3D device. - using (var dxgiDevice = d3DDevice.QueryInterface()) - { - // Wrap the native device using a WinRT interop object. - uint hr = CreateDirect3D11DeviceFromDXGIDevice(dxgiDevice.NativePointer, out IntPtr pUnknown); - - if (hr == 0) - { - d3DInteropDevice = Marshal.GetObjectForIUnknown(pUnknown) as IDirect3DDevice; - Marshal.Release(pUnknown); - } - } - - holographicSpace.SetDirect3D11Device(d3DInteropDevice); - - BeginDraw(null); - ResizeDepthStencilBuffer(backBuffer.Width, backBuffer.Height, 0); - - // Set a dummy back buffer as we use a seperate one for each eye. - BackBuffer = Texture.New(GraphicsDevice, backBuffer.Description, null); - } - - [ComImport] - [Guid("A9B3D012-3DF2-4EE3-B8D1-8695F457D3C1")] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [ComVisible(true)] - private interface IDirect3DDxgiInterfaceAccess : IDisposable - { - IntPtr GetInterface([In] ref Guid iid); - } - - public override Texture BackBuffer { get; } - - public override object NativePresenter => holographicSpace; - - public override bool IsFullScreen { get; set; } - - internal HolographicFrame HolographicFrame { get; set; } - - internal static IDirect3DSurface CreateDirect3DSurface(IntPtr dxgiSurface) - { - uint hr = CreateDirect3D11SurfaceFromDXGISurface(dxgiSurface, out IntPtr inspectableSurface); - - IDirect3DSurface d3DSurface = null; - - if (hr == 0) - { - d3DSurface = Marshal.GetObjectForIUnknown(inspectableSurface) as IDirect3DSurface; - Marshal.Release(inspectableSurface); - } - - return d3DSurface; - } - - public override void BeginDraw(CommandList commandList) - { - HolographicFrame = holographicSpace.CreateNextFrame(); - UpdateBackBuffer(); - } - - public override void Present() - { - HolographicFrame.PresentUsingCurrentPrediction(); - } - - protected override void ResizeBackBuffer(int width, int height, PixelFormat format) - { - UpdateBackBuffer(); - } - - protected override void ResizeDepthStencilBuffer(int width, int height, PixelFormat format) - { - TextureDescription newTextureDescription = DepthStencilBuffer.Description; - newTextureDescription.Width = backBuffer.Width; - newTextureDescription.Height = backBuffer.Height; - - // Manually update the texture. - DepthStencilBuffer.OnDestroyed(); - - // Put it in our back buffer texture. - DepthStencilBuffer.InitializeFrom(newTextureDescription); - } - - [DllImport("d3d11.dll", EntryPoint = "CreateDirect3D11DeviceFromDXGIDevice", - SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] - private static extern uint CreateDirect3D11DeviceFromDXGIDevice(IntPtr dxgiDevice, out IntPtr graphicsDevice); - - [DllImport("d3d11.dll", EntryPoint = "CreateDirect3D11SurfaceFromDXGISurface", - SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] - private static extern uint CreateDirect3D11SurfaceFromDXGISurface(IntPtr dxgiSurface, out IntPtr direct3DSurface); - - private void UpdateBackBuffer() - { - IDirect3DSurface surface = HolographicFrame.GetRenderingParameters(HolographicFrame.CurrentPrediction.CameraPoses[0]).Direct3D11BackBuffer; - IDirect3DDxgiInterfaceAccess surfaceDxgiInterfaceAccess = surface as IDirect3DDxgiInterfaceAccess; - IntPtr resource = surfaceDxgiInterfaceAccess.GetInterface(ID3D11Resource); - - if (backBuffer == null || backBuffer.NativeResource.NativePointer != resource) - { - // Clean up references to previous resources. - backBuffer?.Dispose(); - LeftEyeBuffer?.Dispose(); - RightEyeBuffer?.Dispose(); - - // This can change every frame as the system moves to the next buffer in the - // swap chain. This mode of operation will occur when certain rendering modes - // are activated. - Texture2D d3DBackBuffer = new Texture2D(resource); - - backBuffer = new Texture(GraphicsDevice).InitializeFromImpl(d3DBackBuffer, false); - - LeftEyeBuffer = backBuffer.ToTextureView(new TextureViewDescription() { ArraySlice = 0, Type = ViewType.Single }); - RightEyeBuffer = backBuffer.ToTextureView(new TextureViewDescription() { ArraySlice = 1, Type = ViewType.Single }); - } - - Description.BackBufferFormat = backBuffer.Format; - Description.BackBufferWidth = backBuffer.Width; - Description.BackBufferHeight = backBuffer.Height; - } - } -} - -#endif diff --git a/sources/engine/Stride.Graphics/build/Stride.Graphics.targets b/sources/engine/Stride.Graphics/build/Stride.Graphics.targets index 36756266a..31dbab75a 100644 --- a/sources/engine/Stride.Graphics/build/Stride.Graphics.targets +++ b/sources/engine/Stride.Graphics/build/Stride.Graphics.targets @@ -3,7 +3,6 @@ Direct3D11 - Direct3D11 OpenGLES OpenGLES OpenGL diff --git a/sources/engine/Stride.Input/IGamePadDevice.cs b/sources/engine/Stride.Input/IGamePadDevice.cs index 12fafc503..5ec2aa871 100644 --- a/sources/engine/Stride.Input/IGamePadDevice.cs +++ b/sources/engine/Stride.Input/IGamePadDevice.cs @@ -62,7 +62,7 @@ namespace Stride.Input /// The large left side motor /// The large right side motor /// Values range from 0 to 1, where 0 is off and 1 is maximum vibration - /// Currently vibration is only supported on windows for XInput devices and UWP supported gamepads + /// Currently vibration is only supported on windows for XInput devices void SetVibration(float smallLeft, float smallRight, float largeLeft, float largeRight); } } diff --git a/sources/engine/Stride.Input/InputManager.cs b/sources/engine/Stride.Input/InputManager.cs index 5b16714c1..6a15cd473 100644 --- a/sources/engine/Stride.Input/InputManager.cs +++ b/sources/engine/Stride.Input/InputManager.cs @@ -686,11 +686,6 @@ namespace Stride.Input #if STRIDE_PLATFORM_IOS case AppContextType.iOS: break; -#endif -#if STRIDE_PLATFORM_UWP - case AppContextType.UWPXaml: - case AppContextType.UWPCoreWindow: - break; #endif case AppContextType.Desktop: #if (STRIDE_UI_WINFORMS || STRIDE_UI_WPF) diff --git a/sources/engine/Stride.Input/InputSourceFactory.cs b/sources/engine/Stride.Input/InputSourceFactory.cs index cd923917c..6766ee056 100644 --- a/sources/engine/Stride.Input/InputSourceFactory.cs +++ b/sources/engine/Stride.Input/InputSourceFactory.cs @@ -35,14 +35,6 @@ namespace Stride.Input var iosContext = (GameContextiOS)context; return new InputSourceiOS(iosContext.Control); #endif -#if STRIDE_PLATFORM_UWP - case AppContextType.UWPXaml: - var uwpXamlContext = (GameContextUWPXaml)context; - return new InputSourceUWP(Windows.UI.Xaml.Window.Current.CoreWindow); - case AppContextType.UWPCoreWindow: - var uwpContext = (GameContextUWPCoreWindow)context; - return new InputSourceUWP(uwpContext.Control); -#endif #if (STRIDE_UI_WINFORMS || STRIDE_UI_WPF) case AppContextType.Desktop: var winformsContext = (GameContextWinforms)context; diff --git a/sources/engine/Stride.Input/UWP/GamePadUWP.cs b/sources/engine/Stride.Input/UWP/GamePadUWP.cs deleted file mode 100644 index b222538cb..000000000 --- a/sources/engine/Stride.Input/UWP/GamePadUWP.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using System; -using System.Collections.Generic; -using Windows.Gaming.Input; - -namespace Stride.Input -{ - /// - /// UWP Gamepad - /// - internal class GamePadUWP : GamePadDeviceBase - { - internal Gamepad Gamepad; - private readonly double[] lastAxisState = new double[6]; - private GamePadState state = new GamePadState(); - - private Dictionary buttonMap = new Dictionary - { - [GamepadButtons.DPadDown] = GamePadButton.PadDown, - [GamepadButtons.DPadLeft] = GamePadButton.PadLeft, - [GamepadButtons.DPadRight] = GamePadButton.PadRight, - [GamepadButtons.DPadUp] = GamePadButton.PadUp, - [GamepadButtons.A] = GamePadButton.A, - [GamepadButtons.B] = GamePadButton.B, - [GamepadButtons.X] = GamePadButton.X, - [GamepadButtons.Y] = GamePadButton.Y, - [GamepadButtons.Menu] = GamePadButton.Start, - [GamepadButtons.View] = GamePadButton.Back, - [GamepadButtons.LeftShoulder] = GamePadButton.LeftShoulder, - [GamepadButtons.RightShoulder] = GamePadButton.RightShoulder, - [GamepadButtons.LeftThumbstick] = GamePadButton.LeftThumb, - [GamepadButtons.RightThumbstick] = GamePadButton.RightThumb, - }; - - public GamePadUWP(InputSourceUWP source, Gamepad gamepad, Guid id) - { - Source = source; - Id = id; - ProductId = new Guid("800BE63B-49DC-4214-A4D2-E39E24EA3542"); - Gamepad = gamepad; - } - - public override string Name => "UWP GamePad"; - - public override Guid Id { get; } - - public override Guid ProductId { get; } - - public override IInputSource Source { get; } - - public override GamePadState State => state; - - public override void Update(List inputEvents) - { - var reading = Gamepad.GetCurrentReading(); - - ClearButtonStates(); - - // Check buttons - for (int i = 0; i < 14; i++) - { - int mask = 1 << i; - GamePadButton button = buttonMap[(GamepadButtons)mask]; - var oldState = (state.Buttons & button) != 0; - var newState = (reading.Buttons & (GamepadButtons)mask) != 0; - if (oldState != newState) - { - GamePadButtonEvent buttonEvent = InputEventPool.GetOrCreate(this); - buttonEvent.IsDown = newState; - buttonEvent.Button = button; - inputEvents.Add(buttonEvent); - if (state.Update(buttonEvent)) - { - UpdateButtonState(buttonEvent); - } - } - } - if (ChangeAxis(0, reading.LeftThumbstickX)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.LeftThumbX, reading.LeftThumbstickX)); - if (ChangeAxis(1, reading.LeftThumbstickY)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.LeftThumbY, reading.LeftThumbstickY)); - - if (ChangeAxis(2, reading.RightThumbstickX)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.RightThumbX, reading.RightThumbstickX)); - if (ChangeAxis(3, reading.RightThumbstickY)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.RightThumbY, reading.RightThumbstickY)); - - if (ChangeAxis(4, reading.LeftTrigger)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.LeftTrigger, reading.LeftTrigger)); - if (ChangeAxis(5, reading.RightTrigger)) - inputEvents.Add(CreateAxisEvent(GamePadAxis.RightTrigger, reading.RightTrigger)); - } - - public override void SetVibration(float smallLeft, float smallRight, float largeLeft, float largeRight) - { - Gamepad.Vibration = new GamepadVibration - { - LeftMotor = largeLeft, - LeftTrigger = smallLeft, - RightMotor = largeRight, - RightTrigger = smallLeft, - }; - } - - private bool ChangeAxis(int index, double newValue) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - if (lastAxisState[index] != newValue) - { - lastAxisState[index] = newValue; - return true; - } - return false; - } - - private GamePadAxisEvent CreateAxisEvent(GamePadAxis axis, double newValue) - { - GamePadAxisEvent axisEvent = InputEventPool.GetOrCreate(this); - axisEvent.Value = (float)newValue; - axisEvent.Axis = axis; - state.Update(axisEvent); - return axisEvent; - } - } -} - -#endif \ No newline at end of file diff --git a/sources/engine/Stride.Input/UWP/InputSourceUWP.cs b/sources/engine/Stride.Input/UWP/InputSourceUWP.cs deleted file mode 100644 index 75cac6980..000000000 --- a/sources/engine/Stride.Input/UWP/InputSourceUWP.cs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using System; -using System.Collections.Generic; -using Windows.Devices.Input; -using Windows.Gaming.Input; -using Windows.UI.Core; -using Windows.UI.Xaml; -using Stride.Core.Mathematics; -using Stride.Games; -using WindowsAccelerometer = Windows.Devices.Sensors.Accelerometer; -using WindowsGyroscope = Windows.Devices.Sensors.Gyrometer; -using WindowsOrientation = Windows.Devices.Sensors.OrientationSensor; -using WindowsCompass = Windows.Devices.Sensors.Compass; - -namespace Stride.Input -{ - /// - /// Input source for devices using the universal windows platform - /// - internal class InputSourceUWP : InputSourceBase - { - private const uint DesiredSensorUpdateIntervalMs = (uint)(1f / InputManager.DesiredSensorUpdateRate * 1000f); - - private readonly Dictionary gamePads = new Dictionary(); - - private readonly CoreWindow coreWindow; - private WindowsAccelerometer windowsAccelerometer; - private WindowsCompass windowsCompass; - private WindowsGyroscope windowsGyroscope; - private WindowsOrientation windowsOrientation; - - private AccelerometerSensor accelerometer; - private CompassSensor compass; - private GyroscopeSensor gyroscope; - private OrientationSensor orientation; - private GravitySensor gravity; - private UserAccelerationSensor userAcceleration; - - private PointerUWP pointer; - private KeyboardUWP keyboard; - - public InputSourceUWP(CoreWindow coreWindow) - { - this.coreWindow = coreWindow ?? throw new ArgumentNullException(nameof(coreWindow)); - } - - public override void Initialize(InputManager inputManager) - { - var mouseCapabilities = new MouseCapabilities(); - if (mouseCapabilities.MousePresent > 0) - { - pointer = new MouseUWP(this, coreWindow); - RegisterDevice(pointer); - } - - var keyboardCapabilities = new KeyboardCapabilities(); - if (keyboardCapabilities.KeyboardPresent > 0) - { - keyboard = new KeyboardUWP(this, coreWindow); - RegisterDevice(keyboard); - } - - // get sensor default instances - windowsAccelerometer = WindowsAccelerometer.GetDefault(); - if (windowsAccelerometer != null) - { - accelerometer = new AccelerometerSensor(this, "UWP"); - RegisterDevice(accelerometer); - } - - windowsCompass = WindowsCompass.GetDefault(); - if (windowsCompass != null) - { - compass = new CompassSensor(this, "UWP"); - RegisterDevice(compass); - } - - windowsGyroscope = WindowsGyroscope.GetDefault(); - if (windowsGyroscope != null) - { - gyroscope = new GyroscopeSensor(this, "UWP"); - RegisterDevice(gyroscope); - } - - windowsOrientation = WindowsOrientation.GetDefault(); - if (windowsOrientation != null) - { - orientation = new OrientationSensor(this, "UWP"); - RegisterDevice(orientation); - } - - // Virtual sensors - if (windowsOrientation != null && windowsAccelerometer != null) - { - gravity = new GravitySensor(this, "UWP"); - userAcceleration = new UserAccelerationSensor(this, "UWP"); - RegisterDevice(gravity); - RegisterDevice(userAcceleration); - } - - Gamepad.GamepadAdded += GamepadOnGamepadAdded; - Gamepad.GamepadRemoved += GamepadOnGamepadRemoved; - - Scan(); - } - - public override void Dispose() - { - base.Dispose(); - - Gamepad.GamepadAdded -= GamepadOnGamepadAdded; - Gamepad.GamepadRemoved -= GamepadOnGamepadRemoved; - } - - public override void Scan() - { - base.Scan(); - - foreach (var gamepad in Gamepad.Gamepads) - { - GamepadOnGamepadAdded(this, gamepad); - } - } - - private void GamepadOnGamepadRemoved(object sender, Gamepad gamepad) - { - GamePadUWP currentGamePad; - if (!gamePads.TryGetValue(gamepad, out currentGamePad)) - return; - - gamePads.Remove(gamepad); - UnregisterDevice(currentGamePad); - } - - private void GamepadOnGamepadAdded(object sender, Gamepad gamepad) - { - if (gamePads.ContainsKey(gamepad)) - return; - - GamePadUWP newGamePad = new GamePadUWP(this, gamepad, Guid.NewGuid()); - gamePads.Add(gamepad, newGamePad); - RegisterDevice(newGamePad); - } - - public override void Update() - { - base.Update(); - - // Enable/disable supported sensors and update enabled sensors - if (accelerometer != null) - { - bool enable = accelerometer.IsEnabled || (userAcceleration?.IsEnabled ?? false) || (gravity?.IsEnabled ?? false); - bool isEnabled = windowsAccelerometer.ReportInterval != 0; - - if (enable != isEnabled) - { - windowsAccelerometer.ReportInterval = enable ? Math.Max(DesiredSensorUpdateIntervalMs, windowsAccelerometer.MinimumReportInterval) : 0; - } - - if (enable) - { - accelerometer.Acceleration = GetAcceleration(windowsAccelerometer); - } - } - - if (compass != null) - { - bool enable = compass.IsEnabled; - bool isEnabled = windowsCompass.ReportInterval != 0; - - if (enable != isEnabled) - { - windowsCompass.ReportInterval = enable ? Math.Max(DesiredSensorUpdateIntervalMs, windowsCompass.MinimumReportInterval) : 0; - } - - if (enable) - { - compass.Heading = GetNorth(windowsCompass); - } - } - - if (gyroscope != null) - { - bool enable = gyroscope.IsEnabled; - bool isEnabled = windowsGyroscope.ReportInterval != 0; - - if (enable != isEnabled) - { - windowsGyroscope.ReportInterval = enable ? Math.Max(DesiredSensorUpdateIntervalMs, windowsGyroscope.MinimumReportInterval) : 0; - } - - if (enable) - { - var reading = windowsGyroscope.GetCurrentReading(); - gyroscope.RotationRate = reading != null ? new Vector3((float)reading.AngularVelocityX, (float)reading.AngularVelocityZ, -(float)reading.AngularVelocityY) : Vector3.Zero; - } - } - - if (orientation != null) - { - bool enable = orientation.IsEnabled || (userAcceleration?.IsEnabled ?? false) || (gravity?.IsEnabled ?? false); - bool isEnabled = windowsOrientation.ReportInterval != 0; - - if (enable != isEnabled) - { - windowsOrientation.ReportInterval = enable ? Math.Max(DesiredSensorUpdateIntervalMs, windowsOrientation.MinimumReportInterval) : 0; - } - - if (enable) - { - var quaternion = GetOrientation(windowsOrientation); - orientation.FromQuaternion(quaternion); - - if (userAcceleration.IsEnabled || gravity.IsEnabled) - { - // calculate the gravity direction - var acceleration = GetAcceleration(windowsAccelerometer); - var gravityDirection = Vector3.Transform(-Vector3.UnitY, Quaternion.Invert(quaternion)); - var gravity = InputManager.G * gravityDirection; - - this.gravity.Vector = gravity; - userAcceleration.Acceleration = acceleration - gravity; - } - } - } - } - - public override void Pause() - { - base.Pause(); - - if (windowsAccelerometer != null) - windowsAccelerometer.ReportInterval = 0; - - if (windowsCompass != null) - windowsCompass.ReportInterval = 0; - - if (windowsGyroscope != null) - windowsGyroscope.ReportInterval = 0; - - if (windowsOrientation != null) - windowsOrientation.ReportInterval = 0; - } - - private static Vector3 GetAcceleration(WindowsAccelerometer accelerometer) - { - var currentReading = accelerometer.GetCurrentReading(); - if (currentReading == null) - return Vector3.Zero; - - return InputManager.G * new Vector3((float)currentReading.AccelerationX, (float)currentReading.AccelerationZ, -(float)currentReading.AccelerationY); - } - - private static Quaternion GetOrientation(WindowsOrientation orientation) - { - var reading = orientation.GetCurrentReading(); - if (reading == null) - return Quaternion.Identity; - - var q = reading.Quaternion; - return new Quaternion(q.X, q.Z, -q.Y, q.W); - } - - private static float GetNorth(WindowsCompass compass) - { - var currentReading = compass.GetCurrentReading(); - if (currentReading == null) - return 0f; - - return MathUtil.DegreesToRadians((float)(currentReading.HeadingTrueNorth ?? currentReading.HeadingMagneticNorth)); - } - } -} -#endif diff --git a/sources/engine/Stride.Input/UWP/KeyboardUWP.cs b/sources/engine/Stride.Input/UWP/KeyboardUWP.cs deleted file mode 100644 index a8f36d37d..000000000 --- a/sources/engine/Stride.Input/UWP/KeyboardUWP.cs +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using System; -using Windows.UI.Core; -using System.Collections.Generic; -using Windows.System; - -namespace Stride.Input -{ - internal class KeyboardUWP : KeyboardDeviceBase, IDisposable - { - private static readonly Dictionary mapKeys; - - private readonly CoreWindow uiControl; - - static KeyboardUWP() - { - mapKeys = new Dictionary(); - // this dictionary was built from Desktop version (VirtualKey are compatible with WinForms keys) - AddKeys(WinFormsKeys.None, Keys.None); - AddKeys(WinFormsKeys.Cancel, Keys.Cancel); - AddKeys(WinFormsKeys.Back, Keys.Back); - AddKeys(WinFormsKeys.Tab, Keys.Tab); - AddKeys(WinFormsKeys.LineFeed, Keys.LineFeed); - AddKeys(WinFormsKeys.Clear, Keys.Clear); - AddKeys(WinFormsKeys.Enter, Keys.Enter); - AddKeys(WinFormsKeys.Return, Keys.Return); - AddKeys(WinFormsKeys.Pause, Keys.Pause); - AddKeys(WinFormsKeys.Capital, Keys.Capital); - AddKeys(WinFormsKeys.CapsLock, Keys.CapsLock); - AddKeys(WinFormsKeys.HangulMode, Keys.HangulMode); - AddKeys(WinFormsKeys.KanaMode, Keys.KanaMode); - AddKeys(WinFormsKeys.JunjaMode, Keys.JunjaMode); - AddKeys(WinFormsKeys.FinalMode, Keys.FinalMode); - AddKeys(WinFormsKeys.HanjaMode, Keys.HanjaMode); - AddKeys(WinFormsKeys.KanjiMode, Keys.KanjiMode); - AddKeys(WinFormsKeys.Escape, Keys.Escape); - AddKeys(WinFormsKeys.IMEConvert, Keys.ImeConvert); - AddKeys(WinFormsKeys.IMENonconvert, Keys.ImeNonConvert); - AddKeys(WinFormsKeys.IMEAccept, Keys.ImeAccept); - AddKeys(WinFormsKeys.IMEModeChange, Keys.ImeModeChange); - AddKeys(WinFormsKeys.Space, Keys.Space); - AddKeys(WinFormsKeys.PageUp, Keys.PageUp); - AddKeys(WinFormsKeys.Prior, Keys.Prior); - AddKeys(WinFormsKeys.Next, Keys.Next); - AddKeys(WinFormsKeys.PageDown, Keys.PageDown); - AddKeys(WinFormsKeys.End, Keys.End); - AddKeys(WinFormsKeys.Home, Keys.Home); - AddKeys(WinFormsKeys.Left, Keys.Left); - AddKeys(WinFormsKeys.Up, Keys.Up); - AddKeys(WinFormsKeys.Right, Keys.Right); - AddKeys(WinFormsKeys.Down, Keys.Down); - AddKeys(WinFormsKeys.Select, Keys.Select); - AddKeys(WinFormsKeys.Print, Keys.Print); - AddKeys(WinFormsKeys.Execute, Keys.Execute); - AddKeys(WinFormsKeys.PrintScreen, Keys.PrintScreen); - AddKeys(WinFormsKeys.Snapshot, Keys.Snapshot); - AddKeys(WinFormsKeys.Insert, Keys.Insert); - AddKeys(WinFormsKeys.Delete, Keys.Delete); - AddKeys(WinFormsKeys.Help, Keys.Help); - AddKeys(WinFormsKeys.D0, Keys.D0); - AddKeys(WinFormsKeys.D1, Keys.D1); - AddKeys(WinFormsKeys.D2, Keys.D2); - AddKeys(WinFormsKeys.D3, Keys.D3); - AddKeys(WinFormsKeys.D4, Keys.D4); - AddKeys(WinFormsKeys.D5, Keys.D5); - AddKeys(WinFormsKeys.D6, Keys.D6); - AddKeys(WinFormsKeys.D7, Keys.D7); - AddKeys(WinFormsKeys.D8, Keys.D8); - AddKeys(WinFormsKeys.D9, Keys.D9); - AddKeys(WinFormsKeys.A, Keys.A); - AddKeys(WinFormsKeys.B, Keys.B); - AddKeys(WinFormsKeys.C, Keys.C); - AddKeys(WinFormsKeys.D, Keys.D); - AddKeys(WinFormsKeys.E, Keys.E); - AddKeys(WinFormsKeys.F, Keys.F); - AddKeys(WinFormsKeys.G, Keys.G); - AddKeys(WinFormsKeys.H, Keys.H); - AddKeys(WinFormsKeys.I, Keys.I); - AddKeys(WinFormsKeys.J, Keys.J); - AddKeys(WinFormsKeys.K, Keys.K); - AddKeys(WinFormsKeys.L, Keys.L); - AddKeys(WinFormsKeys.M, Keys.M); - AddKeys(WinFormsKeys.N, Keys.N); - AddKeys(WinFormsKeys.O, Keys.O); - AddKeys(WinFormsKeys.P, Keys.P); - AddKeys(WinFormsKeys.Q, Keys.Q); - AddKeys(WinFormsKeys.R, Keys.R); - AddKeys(WinFormsKeys.S, Keys.S); - AddKeys(WinFormsKeys.T, Keys.T); - AddKeys(WinFormsKeys.U, Keys.U); - AddKeys(WinFormsKeys.V, Keys.V); - AddKeys(WinFormsKeys.W, Keys.W); - AddKeys(WinFormsKeys.X, Keys.X); - AddKeys(WinFormsKeys.Y, Keys.Y); - AddKeys(WinFormsKeys.Z, Keys.Z); - AddKeys(WinFormsKeys.LWin, Keys.LeftWin); - AddKeys(WinFormsKeys.RWin, Keys.RightWin); - AddKeys(WinFormsKeys.Apps, Keys.Apps); - AddKeys(WinFormsKeys.Sleep, Keys.Sleep); - AddKeys(WinFormsKeys.NumPad0, Keys.NumPad0); - AddKeys(WinFormsKeys.NumPad1, Keys.NumPad1); - AddKeys(WinFormsKeys.NumPad2, Keys.NumPad2); - AddKeys(WinFormsKeys.NumPad3, Keys.NumPad3); - AddKeys(WinFormsKeys.NumPad4, Keys.NumPad4); - AddKeys(WinFormsKeys.NumPad5, Keys.NumPad5); - AddKeys(WinFormsKeys.NumPad6, Keys.NumPad6); - AddKeys(WinFormsKeys.NumPad7, Keys.NumPad7); - AddKeys(WinFormsKeys.NumPad8, Keys.NumPad8); - AddKeys(WinFormsKeys.NumPad9, Keys.NumPad9); - AddKeys(WinFormsKeys.Multiply, Keys.Multiply); - AddKeys(WinFormsKeys.Add, Keys.Add); - AddKeys(WinFormsKeys.Separator, Keys.Separator); - AddKeys(WinFormsKeys.Subtract, Keys.Subtract); - AddKeys(WinFormsKeys.Decimal, Keys.Decimal); - AddKeys(WinFormsKeys.Divide, Keys.Divide); - AddKeys(WinFormsKeys.F1, Keys.F1); - AddKeys(WinFormsKeys.F2, Keys.F2); - AddKeys(WinFormsKeys.F3, Keys.F3); - AddKeys(WinFormsKeys.F4, Keys.F4); - AddKeys(WinFormsKeys.F5, Keys.F5); - AddKeys(WinFormsKeys.F6, Keys.F6); - AddKeys(WinFormsKeys.F7, Keys.F7); - AddKeys(WinFormsKeys.F8, Keys.F8); - AddKeys(WinFormsKeys.F9, Keys.F9); - AddKeys(WinFormsKeys.F10, Keys.F10); - AddKeys(WinFormsKeys.F11, Keys.F11); - AddKeys(WinFormsKeys.F12, Keys.F12); - AddKeys(WinFormsKeys.F13, Keys.F13); - AddKeys(WinFormsKeys.F14, Keys.F14); - AddKeys(WinFormsKeys.F15, Keys.F15); - AddKeys(WinFormsKeys.F16, Keys.F16); - AddKeys(WinFormsKeys.F17, Keys.F17); - AddKeys(WinFormsKeys.F18, Keys.F18); - AddKeys(WinFormsKeys.F19, Keys.F19); - AddKeys(WinFormsKeys.F20, Keys.F20); - AddKeys(WinFormsKeys.F21, Keys.F21); - AddKeys(WinFormsKeys.F22, Keys.F22); - AddKeys(WinFormsKeys.F23, Keys.F23); - AddKeys(WinFormsKeys.F24, Keys.F24); - AddKeys(WinFormsKeys.NumLock, Keys.NumLock); - AddKeys(WinFormsKeys.Scroll, Keys.Scroll); - AddKeys(WinFormsKeys.LShiftKey, Keys.LeftShift); - AddKeys(WinFormsKeys.RShiftKey, Keys.RightShift); - AddKeys(WinFormsKeys.LControlKey, Keys.LeftCtrl); - AddKeys(WinFormsKeys.RControlKey, Keys.RightCtrl); - AddKeys(WinFormsKeys.LMenu, Keys.LeftAlt); - AddKeys(WinFormsKeys.RMenu, Keys.RightAlt); - AddKeys(WinFormsKeys.BrowserBack, Keys.BrowserBack); - AddKeys(WinFormsKeys.BrowserForward, Keys.BrowserForward); - AddKeys(WinFormsKeys.BrowserRefresh, Keys.BrowserRefresh); - AddKeys(WinFormsKeys.BrowserStop, Keys.BrowserStop); - AddKeys(WinFormsKeys.BrowserSearch, Keys.BrowserSearch); - AddKeys(WinFormsKeys.BrowserFavorites, Keys.BrowserFavorites); - AddKeys(WinFormsKeys.BrowserHome, Keys.BrowserHome); - AddKeys(WinFormsKeys.VolumeMute, Keys.VolumeMute); - AddKeys(WinFormsKeys.VolumeDown, Keys.VolumeDown); - AddKeys(WinFormsKeys.VolumeUp, Keys.VolumeUp); - AddKeys(WinFormsKeys.MediaNextTrack, Keys.MediaNextTrack); - AddKeys(WinFormsKeys.MediaPreviousTrack, Keys.MediaPreviousTrack); - AddKeys(WinFormsKeys.MediaStop, Keys.MediaStop); - AddKeys(WinFormsKeys.MediaPlayPause, Keys.MediaPlayPause); - AddKeys(WinFormsKeys.LaunchMail, Keys.LaunchMail); - AddKeys(WinFormsKeys.SelectMedia, Keys.SelectMedia); - AddKeys(WinFormsKeys.LaunchApplication1, Keys.LaunchApplication1); - AddKeys(WinFormsKeys.LaunchApplication2, Keys.LaunchApplication2); - AddKeys(WinFormsKeys.Oem1, Keys.Oem1); - AddKeys(WinFormsKeys.OemSemicolon, Keys.OemSemicolon); - AddKeys(WinFormsKeys.Oemplus, Keys.OemPlus); - AddKeys(WinFormsKeys.Oemcomma, Keys.OemComma); - AddKeys(WinFormsKeys.OemMinus, Keys.OemMinus); - AddKeys(WinFormsKeys.OemPeriod, Keys.OemPeriod); - AddKeys(WinFormsKeys.Oem2, Keys.Oem2); - AddKeys(WinFormsKeys.OemQuestion, Keys.OemQuestion); - AddKeys(WinFormsKeys.Oem3, Keys.Oem3); - AddKeys(WinFormsKeys.Oemtilde, Keys.OemTilde); - AddKeys(WinFormsKeys.Oem4, Keys.Oem4); - AddKeys(WinFormsKeys.OemOpenBrackets, Keys.OemOpenBrackets); - AddKeys(WinFormsKeys.Oem5, Keys.Oem5); - AddKeys(WinFormsKeys.OemPipe, Keys.OemPipe); - AddKeys(WinFormsKeys.Oem6, Keys.Oem6); - AddKeys(WinFormsKeys.OemCloseBrackets, Keys.OemCloseBrackets); - AddKeys(WinFormsKeys.Oem7, Keys.Oem7); - AddKeys(WinFormsKeys.OemQuotes, Keys.OemQuotes); - AddKeys(WinFormsKeys.Oem8, Keys.Oem8); - AddKeys(WinFormsKeys.Oem102, Keys.Oem102); - AddKeys(WinFormsKeys.OemBackslash, Keys.OemBackslash); - AddKeys(WinFormsKeys.Attn, Keys.Attn); - AddKeys(WinFormsKeys.Crsel, Keys.CrSel); - AddKeys(WinFormsKeys.Exsel, Keys.ExSel); - AddKeys(WinFormsKeys.EraseEof, Keys.EraseEof); - AddKeys(WinFormsKeys.Play, Keys.Play); - AddKeys(WinFormsKeys.Zoom, Keys.Zoom); - AddKeys(WinFormsKeys.NoName, Keys.NoName); - AddKeys(WinFormsKeys.Pa1, Keys.Pa1); - AddKeys(WinFormsKeys.OemClear, Keys.OemClear); - } - - public KeyboardUWP(InputSourceUWP source, CoreWindow uiControl) - { - Source = source; - this.uiControl = uiControl; - uiControl.KeyDown += CoreWindowOnKeyDown; - uiControl.KeyUp += CoreWindowOnKeyUp; - } - - public void Dispose() - { - uiControl.KeyDown -= CoreWindowOnKeyDown; - uiControl.KeyUp -= CoreWindowOnKeyUp; - } - - public override IInputSource Source { get; } - - public override string Name { get; } = "UWP Keyboard"; - - public override Guid Id { get; } = new Guid("2296CBDF-46EA-4D68-B8E5-5900C25C774D"); - - private static void AddKeys(WinFormsKeys fromKey, Keys toKey) - { - if (!mapKeys.ContainsKey((VirtualKey)fromKey)) - { - mapKeys.Add((VirtualKey)fromKey, toKey); - } - } - - private void HandleKey(bool isDown, VirtualKey virtualKey, CorePhysicalKeyStatus keyStatus) - { - // Remap certain keys - switch (virtualKey) - { - case VirtualKey.Shift: - // Only way to differentiate left and right shift is through the scan code - virtualKey = keyStatus.ScanCode == 54 ? VirtualKey.RightShift : VirtualKey.LeftShift; - break; - case VirtualKey.Control: - virtualKey = keyStatus.IsExtendedKey ? VirtualKey.RightControl : VirtualKey.LeftControl; - break; - case VirtualKey.Menu: - virtualKey = keyStatus.IsExtendedKey ? VirtualKey.RightMenu : VirtualKey.LeftMenu; - break; - } - - // Let Alt + F4 go through - if (virtualKey == VirtualKey.F4 && this.IsKeyDown(Keys.LeftAlt)) - return; - - // Map key to stride key - Keys strideKey; - if (!mapKeys.TryGetValue(virtualKey, out strideKey)) - return; - - if (isDown) - { - HandleKeyDown(strideKey); - } - else - { - HandleKeyUp(strideKey); - } - } - - private void CoreWindowOnKeyDown(CoreWindow sender, KeyEventArgs args) - { - HandleKey(true, args.VirtualKey, args.KeyStatus); - } - - private void CoreWindowOnKeyUp(CoreWindow sender, KeyEventArgs args) - { - HandleKey(false, args.VirtualKey, args.KeyStatus); - } - } -} -#endif diff --git a/sources/engine/Stride.Input/UWP/MouseDeviceStateUWP.cs b/sources/engine/Stride.Input/UWP/MouseDeviceStateUWP.cs deleted file mode 100644 index df3b2e542..000000000 --- a/sources/engine/Stride.Input/UWP/MouseDeviceStateUWP.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using Windows.Devices.Input; -using Windows.UI.Input; -using Stride.Core.Mathematics; - -namespace Stride.Input -{ - internal class MouseDeviceStateUWP : MouseDeviceState - { - public MouseDeviceStateUWP(PointerDeviceState pointerState, IMouseDevice mouseDevice) : base(pointerState, mouseDevice) - { - } - - public void HandlePointerWheelChanged(Windows.UI.Input.PointerPoint point) - { - if (point.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) - { - HandleMouseWheel(point.Properties.MouseWheelDelta / 120.0f); - } - } - - public void HandlePointerMoved(Windows.UI.Input.PointerPoint pointerPoint) - { - if (pointerPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) - { - var newPosition = new Vector2((float)pointerPoint.Position.X, (float)pointerPoint.Position.Y); - HandleMove(newPosition); - } - } - - public void HandlePointerPressed(Windows.UI.Input.PointerPoint point) - { - if (point.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) - { - switch (point.Properties.PointerUpdateKind) - { - case PointerUpdateKind.LeftButtonPressed: - HandleButtonDown(MouseButton.Left); - break; - case PointerUpdateKind.RightButtonPressed: - HandleButtonDown(MouseButton.Right); - break; - case PointerUpdateKind.MiddleButtonPressed: - HandleButtonDown(MouseButton.Middle); - break; - case PointerUpdateKind.XButton1Pressed: - HandleButtonDown(MouseButton.Extended1); - break; - case PointerUpdateKind.XButton2Pressed: - HandleButtonDown(MouseButton.Extended2); - break; - } - } - } - - public void HandlePointerReleased(Windows.UI.Input.PointerPoint point) - { - if (point.PointerDevice.PointerDeviceType == PointerDeviceType.Mouse) - { - switch (point.Properties.PointerUpdateKind) - { - case PointerUpdateKind.LeftButtonReleased: - HandleButtonUp(MouseButton.Left); - break; - case PointerUpdateKind.RightButtonReleased: - HandleButtonUp(MouseButton.Right); - break; - case PointerUpdateKind.MiddleButtonReleased: - HandleButtonUp(MouseButton.Middle); - break; - case PointerUpdateKind.XButton1Released: - HandleButtonUp(MouseButton.Extended1); - break; - case PointerUpdateKind.XButton2Released: - HandleButtonUp(MouseButton.Extended2); - break; - } - } - } - } -} -#endif diff --git a/sources/engine/Stride.Input/UWP/MouseUWP.cs b/sources/engine/Stride.Input/UWP/MouseUWP.cs deleted file mode 100644 index a06388011..000000000 --- a/sources/engine/Stride.Input/UWP/MouseUWP.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using System; -using System.Collections.Generic; -using Windows.Foundation; -using Windows.UI.Core; -using Windows.UI.Xaml; -using Stride.Core.Collections; -using Stride.Core.Mathematics; -using Stride.Games; -using PointUWP = Windows.Foundation.Point; -using Windows.Devices.Input; - -namespace Stride.Input -{ - internal class MouseUWP : PointerUWP, IMouseDevice - { - private MouseDeviceStateUWP mouseState; - private bool isPositionLocked; - private CoreCursor previousCursor; - - public MouseUWP(InputSourceUWP source, CoreWindow uiControl) - : base(source, uiControl) - { - mouseState = new MouseDeviceStateUWP(PointerState, this); - uiControl.PointerWheelChanged += UIControlOnPointerWheelChanged; - } - - public override void Dispose() - { - base.Dispose(); - UIControl.PointerWheelChanged -= UIControlOnPointerWheelChanged; - } - - public override string Name { get; } = "UWP Mouse"; - - public override Guid Id { get; } = new Guid("5156D1C2-7B9B-46E7-A54E-CFCC67DA6958"); - - public bool IsPositionLocked => isPositionLocked; - - public IReadOnlySet PressedButtons => mouseState.PressedButtons; - public IReadOnlySet ReleasedButtons => mouseState.ReleasedButtons; - public IReadOnlySet DownButtons => mouseState.DownButtons; - - public Vector2 Position => mouseState.Position; - public Vector2 Delta => mouseState.Delta; - - public override void Update(List inputEvents) - { - base.Update(inputEvents); - mouseState.Update(inputEvents); - } - - protected override void UIControlOnPointerReleased(CoreWindow o, PointerEventArgs args) - { - mouseState.HandlePointerReleased(args.CurrentPoint); - } - - protected override void UIControlOnPointerPressed(CoreWindow o, PointerEventArgs args) - { - mouseState.HandlePointerPressed(args.CurrentPoint); - } - - protected override void UIControlOnPointerMoved(CoreWindow o, PointerEventArgs args) - { - if (!isPositionLocked) - { - mouseState.HandlePointerMoved(args.CurrentPoint); - } - } - - private void UIControlOnPointerWheelChanged(CoreWindow sender, PointerEventArgs args) - { - mouseState.HandlePointerWheelChanged(args.CurrentPoint); - } - - public void SetPosition(Vector2 normalizedPosition) - { - var position = normalizedPosition * SurfaceSize; - UIControl.PointerPosition = new PointUWP(position.X, position.Y); - } - - private void OnRelativeMouseMoved(MouseDevice sender, MouseEventArgs args) - { - mouseState.HandleMouseDelta( new Vector2((float)args.MouseDelta.X, (float)args.MouseDelta.Y)); - } - - public void LockPosition(bool forceCenter = false) - { - if (!isPositionLocked) - { - MouseDevice.GetForCurrentView().MouseMoved += OnRelativeMouseMoved; - previousCursor = UIControl.PointerCursor; - UIControl.PointerCursor = null; - if (forceCenter) - { - var capturedPosition = new PointUWP(UIControl.Bounds.Left, UIControl.Bounds.Top); - capturedPosition.X += UIControl.Bounds.Width / 2; - capturedPosition.Y += UIControl.Bounds.Height / 2; - UIControl.PointerPosition = capturedPosition; - } - isPositionLocked = true; - } - } - - public void UnlockPosition() - { - if (isPositionLocked) - { - MouseDevice.GetForCurrentView().MouseMoved -= OnRelativeMouseMoved; - UIControl.PointerCursor = previousCursor; - previousCursor = null; - isPositionLocked = false; - } - } - } -} -#endif diff --git a/sources/engine/Stride.Input/UWP/PointerUWP.cs b/sources/engine/Stride.Input/UWP/PointerUWP.cs deleted file mode 100644 index a655fc6b6..000000000 --- a/sources/engine/Stride.Input/UWP/PointerUWP.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -using System; -using Windows.Devices.Input; -using Windows.UI.Core; -using Stride.Core.Mathematics; -using PointerPointUWP = Windows.UI.Input.PointerPoint; -using PointUWP = Windows.Foundation.Point; - -namespace Stride.Input -{ - internal class PointerUWP : PointerDeviceBase, IDisposable - { - protected CoreWindow UIControl; - - public PointerUWP(InputSourceUWP source, CoreWindow uiControl) - { - this.UIControl = uiControl; - Source = source; - - uiControl.SizeChanged += UIControlOnSizeChanged; - uiControl.PointerMoved += UIControlOnPointerMoved; - uiControl.PointerPressed += UIControlOnPointerPressed; - uiControl.PointerReleased += UIControlOnPointerReleased; - uiControl.PointerExited += UIControlOnPointerExited; - uiControl.PointerCaptureLost += UIControlOnPointerCaptureLost; - - // Set initial surface size - SetSurfaceSize(new Vector2((float)uiControl.Bounds.Width, (float)uiControl.Bounds.Height)); - } - - public virtual void Dispose() - { - UIControl.SizeChanged -= UIControlOnSizeChanged; - UIControl.PointerMoved -= UIControlOnPointerMoved; - UIControl.PointerPressed -= UIControlOnPointerPressed; - UIControl.PointerReleased -= UIControlOnPointerReleased; - UIControl.PointerExited -= UIControlOnPointerExited; - UIControl.PointerCaptureLost -= UIControlOnPointerCaptureLost; - } - - public override IInputSource Source { get; } - - public override string Name { get; } = "UWP Pointer"; - - public override Guid Id { get; } = new Guid("9b1e36b6-de69-4313-89dd-7cbfbe1a436e"); - - private void UIControlOnPointerCaptureLost(CoreWindow sender, PointerEventArgs args) - { - HandlePointer(PointerEventType.Canceled, args.CurrentPoint); - } - - private void UIControlOnPointerExited(CoreWindow o, PointerEventArgs args) - { - HandlePointer(PointerEventType.Canceled, args.CurrentPoint); - } - - protected virtual void UIControlOnPointerReleased(CoreWindow o, PointerEventArgs args) - { - HandlePointer(PointerEventType.Released, args.CurrentPoint); - } - - protected virtual void UIControlOnPointerPressed(CoreWindow o, PointerEventArgs args) - { - HandlePointer(PointerEventType.Pressed, args.CurrentPoint); - } - - protected virtual void UIControlOnPointerMoved(CoreWindow o, PointerEventArgs args) - { - HandlePointer(PointerEventType.Moved, args.CurrentPoint); - } - - - private void HandlePointer(PointerEventType type, PointerPointUWP point) - { - if (point.PointerDevice.PointerDeviceType == PointerDeviceType.Touch || point.PointerDevice.PointerDeviceType == PointerDeviceType.Pen) - { - PointerState.PointerInputEvents.Add(new PointerDeviceState.InputEvent - { - Id = (int)point.PointerId, - Position = Normalize(PointToVector2(point.Position)), - Type = type - }); - } - } - - private void UIControlOnSizeChanged(CoreWindow sender, WindowSizeChangedEventArgs sizeChangedEventArgs) - { - var newSize = sizeChangedEventArgs.Size; - SetSurfaceSize(new Vector2((float)newSize.Width, (float)newSize.Height)); - } - private Vector2 PointToVector2(PointUWP point) - { - return new Vector2((float)point.X, (float)point.Y); - } - } -} -#endif diff --git a/sources/engine/Stride.Input/UWP/WinFormsKeys.cs b/sources/engine/Stride.Input/UWP/WinFormsKeys.cs deleted file mode 100644 index e50d91c56..000000000 --- a/sources/engine/Stride.Input/UWP/WinFormsKeys.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP -namespace Stride.Input -{ - internal enum WinFormsKeys - { - Modifiers = -65536, - None = 0, - LButton = 1, - RButton = 2, - Cancel = 3, - MButton = 4, - XButton1 = 5, - XButton2 = 6, - Back = 8, - Tab = 9, - LineFeed = 10, - Clear = 12, - Enter = 13, - Return = 13, - ShiftKey = 16, - ControlKey = 17, - Menu = 18, - Pause = 19, - CapsLock = 20, - Capital = 20, - KanaMode = 21, - HanguelMode = 21, - HangulMode = 21, - JunjaMode = 23, - FinalMode = 24, - KanjiMode = 25, - HanjaMode = 25, - Escape = 27, - IMEConvert = 28, - IMENonconvert = 29, - IMEAceept = 30, - IMEAccept = 30, - IMEModeChange = 31, - Space = 32, - Prior = 33, - PageUp = 33, - Next = 34, - PageDown = 34, - End = 35, - Home = 36, - Left = 37, - Up = 38, - Right = 39, - Down = 40, - Select = 41, - Print = 42, - Execute = 43, - PrintScreen = 44, - Snapshot = 44, - Insert = 45, - Delete = 46, - Help = 47, - D0 = 48, - D1 = 49, - D2 = 50, - D3 = 51, - D4 = 52, - D5 = 53, - D6 = 54, - D7 = 55, - D8 = 56, - D9 = 57, - A = 65, - B = 66, - C = 67, - D = 68, - E = 69, - F = 70, - G = 71, - H = 72, - I = 73, - J = 74, - K = 75, - L = 76, - M = 77, - N = 78, - O = 79, - P = 80, - Q = 81, - R = 82, - S = 83, - T = 84, - U = 85, - V = 86, - W = 87, - X = 88, - Y = 89, - Z = 90, - LWin = 91, - RWin = 92, - Apps = 93, - Sleep = 95, - NumPad0 = 96, - NumPad1 = 97, - NumPad2 = 98, - NumPad3 = 99, - NumPad4 = 100, - NumPad5 = 101, - NumPad6 = 102, - NumPad7 = 103, - NumPad8 = 104, - NumPad9 = 105, - Multiply = 106, - Add = 107, - Separator = 108, - Subtract = 109, - Decimal = 110, - Divide = 111, - F1 = 112, - F2 = 113, - F3 = 114, - F4 = 115, - F5 = 116, - F6 = 117, - F7 = 118, - F8 = 119, - F9 = 120, - F10 = 121, - F11 = 122, - F12 = 123, - F13 = 124, - F14 = 125, - F15 = 126, - F16 = 127, - F17 = 128, - F18 = 129, - F19 = 130, - F20 = 131, - F21 = 132, - F22 = 133, - F23 = 134, - F24 = 135, - NumLock = 144, - Scroll = 145, - LShiftKey = 160, - RShiftKey = 161, - LControlKey = 162, - RControlKey = 163, - LMenu = 164, - RMenu = 165, - BrowserBack = 166, - BrowserForward = 167, - BrowserRefresh = 168, - BrowserStop = 169, - BrowserSearch = 170, - BrowserFavorites = 171, - BrowserHome = 172, - VolumeMute = 173, - VolumeDown = 174, - VolumeUp = 175, - MediaNextTrack = 176, - MediaPreviousTrack = 177, - MediaStop = 178, - MediaPlayPause = 179, - LaunchMail = 180, - SelectMedia = 181, - LaunchApplication1 = 182, - LaunchApplication2 = 183, - Oem1 = 186, - OemSemicolon = 186, - Oemplus = 187, - Oemcomma = 188, - OemMinus = 189, - OemPeriod = 190, - OemQuestion = 191, - Oem2 = 191, - Oemtilde = 192, - Oem3 = 192, - Oem4 = 219, - OemOpenBrackets = 219, - OemPipe = 220, - Oem5 = 220, - Oem6 = 221, - OemCloseBrackets = 221, - Oem7 = 222, - OemQuotes = 222, - Oem8 = 223, - Oem102 = 226, - OemBackslash = 226, - ProcessKey = 229, - Packet = 231, - Attn = 246, - Crsel = 247, - Exsel = 248, - EraseEof = 249, - Play = 250, - Zoom = 251, - NoName = 252, - Pa1 = 253, - OemClear = 254, - KeyCode = 65535, - Shift = 65536, - Control = 131072, - Alt = 262144, - } -} -#endif \ No newline at end of file diff --git a/sources/engine/Stride.Native/Stride.Native.Libs.targets b/sources/engine/Stride.Native/Stride.Native.Libs.targets index daf9c1760..cef2fc33b 100644 --- a/sources/engine/Stride.Native/Stride.Native.Libs.targets +++ b/sources/engine/Stride.Native/Stride.Native.Libs.targets @@ -1,7 +1,6 @@ libCompilerRt.lib libCelt.lib Recast.lib Detour.lib - libCompilerRt.lib libCelt.lib Xaudio2.lib Recast.lib Detour.lib diff --git a/sources/engine/Stride.Navigation/Stride.Native.Libs.targets b/sources/engine/Stride.Navigation/Stride.Native.Libs.targets index b704bec2b..7897aa8f6 100644 --- a/sources/engine/Stride.Navigation/Stride.Native.Libs.targets +++ b/sources/engine/Stride.Navigation/Stride.Native.Libs.targets @@ -1,7 +1,6 @@ Recast.lib Detour.lib - Recast.lib Detour.lib diff --git a/sources/engine/Stride.Shaders.Compiler/EffectCompiler.cs b/sources/engine/Stride.Shaders.Compiler/EffectCompiler.cs index 66a4a01f7..6d3eb201d 100644 --- a/sources/engine/Stride.Shaders.Compiler/EffectCompiler.cs +++ b/sources/engine/Stride.Shaders.Compiler/EffectCompiler.cs @@ -204,8 +204,6 @@ namespace Stride.Shaders.Compiler #if STRIDE_PLATFORM_DESKTOP case GraphicsPlatform.Direct3D11: case GraphicsPlatform.Direct3D12: - if (Platform.Type != PlatformType.Windows && Platform.Type != PlatformType.UWP) - throw new NotSupportedException(); compiler = new Direct3D.ShaderCompiler(); break; #endif diff --git a/sources/engine/Stride.Shaders.Compiler/OpenGL/ShaderCompiler.cs b/sources/engine/Stride.Shaders.Compiler/OpenGL/ShaderCompiler.cs index c4d434588..9f7078e50 100644 --- a/sources/engine/Stride.Shaders.Compiler/OpenGL/ShaderCompiler.cs +++ b/sources/engine/Stride.Shaders.Compiler/OpenGL/ShaderCompiler.cs @@ -119,7 +119,6 @@ namespace Stride.Shaders.Compiler.OpenGL switch (Platform.Type) { case PlatformType.Windows: - case PlatformType.UWP: filename = @"win-x64\glslangValidator.exe"; break; case PlatformType.Linux: diff --git a/sources/engine/Stride.Shaders.Compiler/Stride.Shaders.Compiler.csproj b/sources/engine/Stride.Shaders.Compiler/Stride.Shaders.Compiler.csproj index 42d4cb936..94a302a6f 100644 --- a/sources/engine/Stride.Shaders.Compiler/Stride.Shaders.Compiler.csproj +++ b/sources/engine/Stride.Shaders.Compiler/Stride.Shaders.Compiler.csproj @@ -19,7 +19,7 @@ - + diff --git a/sources/engine/Stride.UI/Controls/EditText.UWP.cs b/sources/engine/Stride.UI/Controls/EditText.UWP.cs deleted file mode 100644 index 03c1f715d..000000000 --- a/sources/engine/Stride.UI/Controls/EditText.UWP.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -#if STRIDE_PLATFORM_UWP -using System; -using Windows.UI; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Media; -using Stride.Core; -using Stride.Core.Annotations; -using Stride.Games; - -namespace Stride.UI.Controls -{ - // Note: this completes EditText.Direct.cs - public partial class EditText - { - private static EditText activeEditText; - private Windows.UI.Xaml.Controls.TextBox editText; - private GameContextUWPXaml gameContext; - - private static void InitializeStaticImpl() - { - } - - private void InitializeImpl() - { - } - - private int GetLineCountImpl() - { - if (Font == null) - return 1; - - return text.Split('\n').Length; - } - - private void OnMaxLinesChangedImpl() - { - } - - private void OnMinLinesChangedImpl() - { - } - - private void ActivateEditTextImpl() - { - // try to show the virtual keyboard if no hardward keyboard available - Windows.UI.ViewManagement.InputPane.GetForCurrentView().TryShow(); - - var game = GetGame(); - - // Detach previous EditText (if any) - if (activeEditText != null) - activeEditText.IsSelectionActive = false; - activeEditText = this; - - // Handle only GameContextUWPXaml for now - // TODO: Implement EditText for GameContextUWPCoreWindow - gameContext = game.Context as GameContextUWPXaml; - if (gameContext == null) - return; - - var swapChainPanel = gameContext.Control; - - // Make sure it doesn't have a parent (another text box being edited) - editText = gameContext.EditTextBox; - editText.Text = text; - swapChainPanel.Children.Add(new Windows.UI.Xaml.Controls.Grid { Children = { editText }, Opacity = 0.7f, Background = new SolidColorBrush(Colors.Black)}); - - editText.TextChanged += EditText_TextChanged; - editText.KeyDown += EditText_KeyDown; - } - - private void EditText_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e) - { - // validate the text with "enter" or "escape" - if (e.Key == Windows.System.VirtualKey.Enter || e.Key == Windows.System.VirtualKey.Escape) - { - IsSelectionActive = false; - e.Handled = true; - } - } - - private void EditText_TextChanged(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e) - { - if (editText == null) - return; - - // early exit if text did not changed - if (text == editText.Text) - return; - - // Make sure selection is not reset - var editSelectionStart = editText.SelectionStart; - - SetTextInternal(editText.Text, false); - UpdateTextToEditImpl(); - - if (editSelectionStart >= text.Length) - editSelectionStart = text.Length; - editText.SelectionStart = editSelectionStart; - - UpdateSelectionFromEditImpl(); - } - - private void DeactivateEditTextImpl() - { - if (editText != null) - { - // Remove text box - editText.TextChanged -= EditText_TextChanged; - editText.KeyDown -= EditText_KeyDown; - var stackPanel = (Windows.UI.Xaml.Controls.Panel)editText.Parent; - stackPanel.Children.Remove(editText); - - var swapChainControl = gameContext?.Control; - swapChainControl?.Children.Remove(stackPanel); - - editText = null; - activeEditText = null; - } - FocusedElement = null; - } - - private void UpdateTextToEditImpl() - { - if (editText == null) - return; - - if (editText.Text != Text) // avoid infinite text changed triggering loop. - { - editText.Text = text; - } - } - - private void UpdateInputTypeImpl() - { - } - - private void UpdateSelectionFromEditImpl() - { - if (editText == null) - return; - - selectionStart = editText.SelectionStart; - selectionStop = editText.SelectionStart + editText.SelectionLength; - } - - private void UpdateSelectionToEditImpl() - { - if (editText == null) - return; - - editText.Select(selectionStart, selectionStop - selectionStart); - } - - private void OnTouchDownImpl(TouchEventArgs args) - { - } - - private void OnTouchMoveImpl(TouchEventArgs args) - { - } - - private void OnTouchUpImpl(TouchEventArgs args) - { - if (editText.FocusState == FocusState.Unfocused) - editText.Focus(FocusState.Programmatic); - } - - [NotNull] - private IGame GetGame() - { - if (UIElementServices.Services == null) - throw new InvalidOperationException("services"); - - return UIElementServices.Services.GetSafeServiceAs(); - } - } -} -#endif diff --git a/sources/engine/Stride.Video/Stride.Video.csproj b/sources/engine/Stride.Video/Stride.Video.csproj index 104ba52b9..972a767cb 100644 --- a/sources/engine/Stride.Video/Stride.Video.csproj +++ b/sources/engine/Stride.Video/Stride.Video.csproj @@ -24,8 +24,8 @@ - - + + diff --git a/sources/engine/Stride.VirtualReality/VRDeviceSystem.cs b/sources/engine/Stride.VirtualReality/VRDeviceSystem.cs index c5b2147fd..750a87cba 100644 --- a/sources/engine/Stride.VirtualReality/VRDeviceSystem.cs +++ b/sources/engine/Stride.VirtualReality/VRDeviceSystem.cs @@ -91,12 +91,6 @@ namespace Stride.VirtualReality } case VRApi.WindowsMixedReality: { -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP - if (Windows.Graphics.Holographic.HolographicSpace.IsAvailable && GraphicsDevice.Presenter is WindowsMixedRealityGraphicsPresenter) - { - Device = new WindowsMixedRealityHmd(); - } -#endif break; } default: diff --git a/sources/engine/Stride.VirtualReality/WindowsMixedReality/SystemNumericsExtensions.cs b/sources/engine/Stride.VirtualReality/WindowsMixedReality/SystemNumericsExtensions.cs deleted file mode 100644 index 327c58f4c..000000000 --- a/sources/engine/Stride.VirtualReality/WindowsMixedReality/SystemNumericsExtensions.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_PLATFORM_UWP - -using Stride.Core.Mathematics; - -namespace Stride.VirtualReality -{ - internal static class SystemNumericsExtensions - { - /// - /// Performs a conversion from to . - /// - /// The value. - /// The result of the conversion. - public static Matrix ToMatrix(this System.Numerics.Matrix4x4 value) - { - return new Matrix() - { - M11 = value.M11, M12 = value.M12, M13 = value.M13, M14 = value.M14, - M21 = value.M21, M22 = value.M22, M23 = value.M23, M24 = value.M24, - M31 = value.M31, M32 = value.M32, M33 = value.M33, M34 = value.M34, - M41 = value.M41, M42 = value.M42, M43 = value.M43, M44 = value.M44 - }; - } - - /// - /// Performs a conversion from to . - /// - /// The value. - /// The result of the conversion. - public static Quaternion ToQuaternion(this System.Numerics.Quaternion value) - { - return new Quaternion(value.X, value.Y, value.Z, value.W); - } - - /// - /// Performs a conversion from to . - /// - /// The value. - /// The result of the conversion. - public static Vector3 ToVector3(this System.Numerics.Vector3 value) - { - return new Vector3(value.X, value.Y, value.Z); - } - } -} - -#endif diff --git a/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityHmd.cs b/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityHmd.cs deleted file mode 100644 index c074c41f1..000000000 --- a/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityHmd.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP -using System; -using Windows.Graphics.DirectX.Direct3D11; -using Windows.Graphics.Holographic; -using Windows.Perception.Spatial; -using Windows.UI.Input.Spatial; -using Stride.Core.Mathematics; -using Stride.Games; -using Stride.Graphics; - -namespace Stride.VirtualReality -{ - internal class WindowsMixedRealityHmd : VRDevice - { - private Matrix currentView = Matrix.Identity; - private WindowsMixedRealityGraphicsPresenter graphicsPresenter; - private HolographicCamera holographicCamera; - private HolographicSpace holographicSpace; - private SpatialInteractionManager interactionManager; - private DeviceState internalState; - private WindowsMixedRealityTouchController leftHandController; - private WindowsMixedRealityTouchController rightHandController; - private SpatialLocation spatialLocation; - private SpatialLocator spatialLocator; - private SpatialStationaryFrameOfReference stationaryReferenceFrame; - - public WindowsMixedRealityHmd() - { - VRApi = VRApi.WindowsMixedReality; - SupportsOverlays = false; - } - - public override Size2 OptimalRenderFrameSize => ActualRenderFrameSize; - - public override Size2 ActualRenderFrameSize - { - get => new Size2((int)holographicCamera.RenderTargetSize.Width * 2, (int)holographicCamera.RenderTargetSize.Height); - protected set { } - } - - public override Texture MirrorTexture { get; protected set; } - - public override float RenderFrameScaling - { - get => (float)holographicCamera.ViewportScaleFactor; - set { if (holographicCamera != null) holographicCamera.ViewportScaleFactor = value; } - } - - public override DeviceState State => internalState; - - public override Vector3 HeadPosition => spatialLocation.Position.ToVector3(); - - public override Quaternion HeadRotation => spatialLocation.Orientation.ToQuaternion(); - - public override Vector3 HeadLinearVelocity => spatialLocation.AbsoluteLinearVelocity.ToVector3(); - - public override Vector3 HeadAngularVelocity => spatialLocation.AbsoluteAngularVelocity.ToQuaternion().YawPitchRoll; - - public override TouchController LeftHand => leftHandController; - - public override TouchController RightHand => rightHandController; - - public override TrackedItem[] TrackedItems => Array.Empty(); - - public override bool CanInitialize => true; - - public override void Commit(CommandList commandList, Texture renderFrame) - { - // On versions of the platform that support the CommitDirect3D11DepthBuffer API, we can - // provide the depth buffer to the system, and it will use depth information to stabilize - // the image at a per-pixel level. - var pose = graphicsPresenter.HolographicFrame.CurrentPrediction.CameraPoses[0]; - HolographicCameraRenderingParameters renderingParameters = graphicsPresenter.HolographicFrame.GetRenderingParameters(pose); - SharpDX.Direct3D11.Texture2D depthBuffer = new SharpDX.Direct3D11.Texture2D(commandList.DepthStencilBuffer.NativeResource.NativePointer); - - // Direct3D interop APIs are used to provide the buffer to the WinRT API. - SharpDX.DXGI.Resource1 depthStencilResource = depthBuffer.QueryInterface(); - SharpDX.DXGI.Surface2 depthDxgiSurface = new SharpDX.DXGI.Surface2(depthStencilResource, 0); - IDirect3DSurface depthD3DSurface = WindowsMixedRealityGraphicsPresenter.CreateDirect3DSurface(depthDxgiSurface.NativePointer); - - if (depthD3DSurface != null) - { - // Calling CommitDirect3D11DepthBuffer causes the system to queue Direct3D commands to - // read the depth buffer. It will then use that information to stabilize the image as - // the HolographicFrame is presented. - renderingParameters.CommitDirect3D11DepthBuffer(depthD3DSurface); - } - } - - public override void Draw(GameTime gameTime) - { - } - - public override void Enable(GraphicsDevice device, GraphicsDeviceManager graphicsDeviceManager, bool requireMirror, int mirrorWidth, int mirrorHeight) - { - HolographicSpace.IsAvailableChanged += HolographicSpace_IsAvailableChanged; - HolographicSpace_IsAvailableChanged(null, null); - - graphicsPresenter = device.Presenter as WindowsMixedRealityGraphicsPresenter; - - holographicSpace = graphicsPresenter.NativePresenter as HolographicSpace; - holographicCamera = graphicsPresenter.HolographicFrame.CurrentPrediction.CameraPoses[0].HolographicCamera; - - interactionManager = SpatialInteractionManager.GetForCurrentView(); - - leftHandController = new WindowsMixedRealityTouchController(TouchControllerHand.Left, interactionManager); - rightHandController = new WindowsMixedRealityTouchController(TouchControllerHand.Right, interactionManager); - - MirrorTexture = graphicsPresenter.BackBuffer; - } - - public override void ReadEyeParameters(Eyes eye, float near, float far, ref Vector3 cameraPosition, ref Matrix cameraRotation, bool ignoreHeadRotation, bool ignoreHeadPosition, out Matrix view, out Matrix projection) - { - var cameraPose = graphicsPresenter.HolographicFrame.CurrentPrediction.CameraPoses[0]; - - cameraPose.HolographicCamera.SetNearPlaneDistance(near); - cameraPose.HolographicCamera.SetFarPlaneDistance(far); - - var viewTransform = cameraPose.TryGetViewTransform(stationaryReferenceFrame.CoordinateSystem); - - if (viewTransform.HasValue) - { - currentView = eye == Eyes.Left - ? viewTransform.Value.Left.ToMatrix() - : viewTransform.Value.Right.ToMatrix(); - } - - if (ignoreHeadPosition) - { - currentView.TranslationVector = Vector3.Zero; - } - - if (ignoreHeadRotation) - { - // keep the scale just in case - currentView.Row1 = new Vector4(currentView.Row1.Length(), 0, 0, 0); - currentView.Row2 = new Vector4(0, currentView.Row2.Length(), 0, 0); - currentView.Row3 = new Vector4(0, 0, currentView.Row3.Length(), 0); - } - - view = Matrix.Translation(-cameraPosition) * cameraRotation * currentView; - - projection = eye == Eyes.Left - ? cameraPose.ProjectionTransform.Left.ToMatrix() - : cameraPose.ProjectionTransform.Right.ToMatrix(); - } - - public override void Update(GameTime gameTime) - { - HolographicFramePrediction prediction = graphicsPresenter.HolographicFrame.CurrentPrediction; - - SpatialCoordinateSystem coordinateSystem = stationaryReferenceFrame.CoordinateSystem; - spatialLocation = spatialLocator.TryLocateAtTimestamp(prediction.Timestamp, coordinateSystem); - - leftHandController.Update(prediction.Timestamp, coordinateSystem); - rightHandController.Update(prediction.Timestamp, coordinateSystem); - } - - private void HolographicSpace_IsAvailableChanged(object sender, object e) - { - internalState = HolographicSpace.IsAvailable ? DeviceState.Valid : DeviceState.Invalid; - - HolographicDisplay holographicDisplay = HolographicDisplay.GetDefault(); - SpatialLocator newSpatialLocator = holographicDisplay?.SpatialLocator; - - if (spatialLocator != newSpatialLocator) - { - if (spatialLocator != null) - { - spatialLocator.LocatabilityChanged -= SpatialLocator_LocatabilityChanged; - spatialLocator = null; - } - - if (newSpatialLocator != null) - { - spatialLocator = newSpatialLocator; - spatialLocator.LocatabilityChanged += SpatialLocator_LocatabilityChanged; - stationaryReferenceFrame = spatialLocator.CreateStationaryFrameOfReferenceAtCurrentLocation(); - } - } - } - - private void SpatialLocator_LocatabilityChanged(SpatialLocator sender, object args) - { - switch (sender.Locatability) - { - case SpatialLocatability.Unavailable: - internalState = DeviceState.Invalid; - break; - default: - internalState = DeviceState.Valid; - break; - } - } - } -} - -#endif diff --git a/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityTouchController.cs b/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityTouchController.cs deleted file mode 100644 index 37ba6f13a..000000000 --- a/sources/engine/Stride.VirtualReality/WindowsMixedReality/WindowsMixedRealityTouchController.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. - -#if STRIDE_GRAPHICS_API_DIRECT3D11 && STRIDE_PLATFORM_UWP - -using Windows.Perception; -using Windows.Perception.Spatial; -using Windows.UI.Input.Spatial; -using Stride.Core.Mathematics; - -namespace Stride.VirtualReality -{ - internal class WindowsMixedRealityTouchController : TouchController - { - private readonly SpatialInteractionSourceHandedness hand; - private readonly SpatialInteractionManager interactionManager; - - private Vector3 currentAngularVelocity; - private Vector3 currentLinearVelocity; - private Vector3 currentPosition; - private Quaternion currentRotation = Quaternion.Identity; - private SpatialInteractionSourceState currentState; - private DeviceState internalState; - private SpatialInteractionSourceState previousState; - - internal WindowsMixedRealityTouchController(TouchControllerHand hand, SpatialInteractionManager interactionManager) - { - this.hand = (SpatialInteractionSourceHandedness)(hand + 1); - this.interactionManager = interactionManager; - - interactionManager.SourceLost += InteractionManager_SourceLost; - } - - public override Vector3 Position => currentPosition; - - public override Quaternion Rotation => currentRotation; - - public override Vector3 LinearVelocity => currentLinearVelocity; - - public override Vector3 AngularVelocity => currentAngularVelocity; - - public override DeviceState State => internalState; - - public override float Trigger => (float)currentState.SelectPressedValue; - - public override float Grip => currentState.IsGrasped ? 1.0f : 0.0f; - - public override bool IndexPointing => false; - - public override bool IndexResting => true; - - public override bool ThumbUp => !currentState.ControllerProperties.IsTouchpadTouched; - - public override bool ThumbResting => currentState.ControllerProperties.IsTouchpadTouched; - - public override Vector2 ThumbAxis => new Vector2((float)currentState.ControllerProperties.TouchpadX, (float)currentState.ControllerProperties.TouchpadY); - - public override Vector2 ThumbstickAxis => new Vector2((float)currentState.ControllerProperties.ThumbstickX, (float)currentState.ControllerProperties.ThumbstickY); - - public override bool IsPressed(TouchControllerButton button) => IsButtonPressed(button, currentState); - - public override bool IsPressedDown(TouchControllerButton button) => !IsButtonPressed(button, previousState) ? IsButtonPressed(button, currentState) : false; - - public override bool IsPressReleased(TouchControllerButton button) => IsButtonPressed(button, previousState) ? !IsButtonPressed(button, currentState) : false; - - public override bool IsTouched(TouchControllerButton button) => !IsButtonTouched(button, currentState); - - public override bool IsTouchedDown(TouchControllerButton button) => !IsButtonTouched(button, previousState) ? IsButtonTouched(button, currentState) : false; - - public override bool IsTouchReleased(TouchControllerButton button) => IsButtonTouched(button, previousState) ? !IsButtonTouched(button, currentState) : false; - - public override ControllerHaptics HapticsSupport => ControllerHaptics.None; - - public void Update(PerceptionTimestamp timeStamp, SpatialCoordinateSystem coordinateSystem) - { - var states = interactionManager.GetDetectedSourcesAtTimestamp(timeStamp); - - foreach (SpatialInteractionSourceState state in states) - { - if (state.Source.Handedness == hand) - { - SpatialInteractionSourceLocation location = state.Properties.TryGetLocation(coordinateSystem); - - if (location != null) - { - SetSpatialInteractionSourceLocation(location); - } - - previousState = currentState; - currentState = state; - - internalState = previousState != null ? DeviceState.Valid : DeviceState.Invalid; - } - } - } - - private bool IsButtonPressed(TouchControllerButton button, SpatialInteractionSourceState state) - { - switch (button) - { - case TouchControllerButton.Thumbstick: - return state.ControllerProperties.IsThumbstickPressed; - case TouchControllerButton.Touchpad: - return state.ControllerProperties.IsTouchpadPressed; - case TouchControllerButton.A when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Right: - return ThumbAxis.X >= 0.0f; - case TouchControllerButton.B when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Right: - return ThumbAxis.X < 0.0f; - case TouchControllerButton.X when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Left: - return ThumbAxis.X < 0.0f; - case TouchControllerButton.Y when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Left: - return ThumbAxis.X >= 0.0f; - case TouchControllerButton.Trigger: - return state.IsSelectPressed; - case TouchControllerButton.Grip: - return state.IsGrasped; - case TouchControllerButton.Menu: - return state.IsMenuPressed; - default: - return false; - } - } - - private bool IsButtonTouched(TouchControllerButton button, SpatialInteractionSourceState state) - { - switch (button) - { - case TouchControllerButton.Touchpad: - return state.ControllerProperties.IsTouchpadTouched; - case TouchControllerButton.A when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Right: - return ThumbAxis.X >= 0.0f; - case TouchControllerButton.B when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Right: - return ThumbAxis.X < 0.0f; - case TouchControllerButton.X when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Left: - return ThumbAxis.X < 0.0f; - case TouchControllerButton.Y when state.ControllerProperties.IsTouchpadPressed && hand == SpatialInteractionSourceHandedness.Left: - return ThumbAxis.X >= 0.0f; - default: - return false; - } - } - - private void InteractionManager_SourceLost(SpatialInteractionManager sender, SpatialInteractionSourceEventArgs args) - { - if (args.State.Source.Handedness == hand) - { - internalState = DeviceState.Invalid; - - previousState = null; - currentState = null; - } - } - - private void SetSpatialInteractionSourceLocation(SpatialInteractionSourceLocation location) - { - currentPosition = location.Position?.ToVector3() ?? currentPosition; - currentRotation = location.Orientation?.ToQuaternion() ?? currentRotation; - currentLinearVelocity = location.Velocity?.ToVector3() ?? currentLinearVelocity; - currentAngularVelocity = location.AngularVelocity?.ToVector3() ?? currentAngularVelocity; - } - - //TODO: implement this - public override async Task Vibrate(int duration, float frequency, float amplitude) { } - } -} - -#endif diff --git a/sources/engine/Stride/Data/ConfigPlatforms.cs b/sources/engine/Stride/Data/ConfigPlatforms.cs index 744bfef5d..b9078f8b0 100644 --- a/sources/engine/Stride/Data/ConfigPlatforms.cs +++ b/sources/engine/Stride/Data/ConfigPlatforms.cs @@ -11,7 +11,6 @@ namespace Stride.Data { None = 0, Windows = 1 << PlatformType.Windows, - UWP = 1 << PlatformType.UWP, iOS = 1 << PlatformType.iOS, Android = 1 << PlatformType.Android, Linux = 1 << PlatformType.Linux, diff --git a/sources/engine/Stride/Data/PlatformConfigurations.cs b/sources/engine/Stride/Data/PlatformConfigurations.cs index f60927095..1bf07e056 100644 --- a/sources/engine/Stride/Data/PlatformConfigurations.cs +++ b/sources/engine/Stride/Data/PlatformConfigurations.cs @@ -42,9 +42,6 @@ namespace Stride.Data case PlatformType.iOS: platform = ConfigPlatforms.iOS; break; - case PlatformType.UWP: - platform = ConfigPlatforms.UWP; - break; case PlatformType.Linux: platform = ConfigPlatforms.Linux; break; diff --git a/sources/engine/Stride/Graphics/StandardImageHelper.UWP.cs b/sources/engine/Stride/Graphics/StandardImageHelper.UWP.cs deleted file mode 100644 index 8a392e25d..000000000 --- a/sources/engine/Stride/Graphics/StandardImageHelper.UWP.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -#if STRIDE_PLATFORM_UWP -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace Stride.Graphics -{ - /// - /// This class is responsible to provide image loader for png, gif, bmp. - /// TODO: Replace using System.Drawing, as it is not available on all platforms (not on Windows 8/WP8). - /// - partial class StandardImageHelper - { - public static unsafe Image LoadFromMemory(IntPtr pSource, int size, bool makeACopy, GCHandle? handle) - { - return WICHelper.LoadFromWICMemory(pSource, size, makeACopy, handle); - } - - public static void SaveGifFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - WICHelper.SaveGifToWICMemory(pixelBuffers, count, description, imageStream); - } - - public static void SaveTiffFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - WICHelper.SaveTiffToWICMemory(pixelBuffers, count, description, imageStream); - } - - public static void SaveBmpFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - WICHelper.SaveBmpToWICMemory(pixelBuffers, count, description, imageStream); - } - - public static void SaveJpgFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - WICHelper.SaveJpgToWICMemory(pixelBuffers, count, description, imageStream); - } - - public static void SavePngFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - WICHelper.SavePngToWICMemory(pixelBuffers, count, description, imageStream); - } - - public static void SaveWmpFromMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - throw new NotImplementedException(); - } - } -} -#endif diff --git a/sources/engine/Stride/Graphics/WICFlags.cs b/sources/engine/Stride/Graphics/WICFlags.cs deleted file mode 100644 index d80fcc0bf..000000000 --- a/sources/engine/Stride/Graphics/WICFlags.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -// -// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// ----------------------------------------------------------------------------- -// The following code is a port of DirectXTex http://directxtex.codeplex.com -// ----------------------------------------------------------------------------- -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the -// software, you accept this license. If you do not accept the license, do not -// use the software. -// -// 1. Definitions -// The terms "reproduce," "reproduction," "derivative works," and -// "distribution" have the same meaning here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to -// the software. -// A "contributor" is any person that distributes its contribution under this -// license. -// "Licensed patents" are a contributor's patent claims that read directly on -// its contribution. -// -// 2. Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the -// license conditions and limitations in section 3, each contributor grants -// you a non-exclusive, worldwide, royalty-free copyright license to reproduce -// its contribution, prepare derivative works of its contribution, and -// distribute its contribution or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license -// conditions and limitations in section 3, each contributor grants you a -// non-exclusive, worldwide, royalty-free license under its licensed patents to -// make, have made, use, sell, offer for sale, import, and/or otherwise dispose -// of its contribution in the software or derivative works of the contribution -// in the software. -// -// 3. Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any -// contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that -// you claim are infringed by the software, your patent license from such -// contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all -// copyright, patent, trademark, and attribution notices that are present in the -// software. -// (D) If you distribute any portion of the software in source code form, you -// may do so only under this license by including a complete copy of this -// license with your distribution. If you distribute any portion of the software -// in compiled or object code form, you may only do so under a license that -// complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The -// contributors give no express warranties, guarantees or conditions. You may -// have additional consumer rights under your local laws which this license -// cannot change. To the extent permitted under your local laws, the -// contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. -#if STRIDE_PLATFORM_UWP -using System; - -namespace Stride.Graphics -{ - [Flags] - internal enum WICFlags - { - None = 0x0, - - ForceRgb = 0x1, - // Loads DXGI 1.1 BGR formats as DXGI_FORMAT_R8G8B8A8_UNORM to avoid use of optional WDDM 1.1 formats - - NoX2Bias = 0x2, - // Loads DXGI 1.1 X2 10:10:10:2 format as DXGI_FORMAT_R10G10B10A2_UNORM - - No16Bpp = 0x4, - // Loads 565, 5551, and 4444 formats as 8888 to avoid use of optional WDDM 1.2 formats - - FlagsAllowMono = 0x8, - // Loads 1-bit monochrome (black & white) as R1_UNORM rather than 8-bit greyscale - - AllFrames = 0x10, - // Loads all images in a multi-frame file, converting/resizing to match the first frame as needed, defaults to 0th frame otherwise - - Dither = 0x10000, - // Use ordered 4x4 dithering for any required conversions - - DitherDiffusion = 0x20000, - // Use error-diffusion dithering for any required conversions - - FilterPoint = 0x100000, - FilterLinear = 0x200000, - FilterCubic = 0x300000, - FilterFant = 0x400000, // Combination of Linear and Box filter - // Filtering mode to use for any required image resizing (only needed when loading arrays of differently sized images; defaults to Fant) - }; -} -#endif diff --git a/sources/engine/Stride/Graphics/WICHelper.cs b/sources/engine/Stride/Graphics/WICHelper.cs deleted file mode 100644 index 6d17c8b49..000000000 --- a/sources/engine/Stride/Graphics/WICHelper.cs +++ /dev/null @@ -1,745 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -// -// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// ----------------------------------------------------------------------------- -// The following code is a port of DirectXTex http://directxtex.codeplex.com -// ----------------------------------------------------------------------------- -// Microsoft Public License (Ms-PL) -// -// This license governs use of the accompanying software. If you use the -// software, you accept this license. If you do not accept the license, do not -// use the software. -// -// 1. Definitions -// The terms "reproduce," "reproduction," "derivative works," and -// "distribution" have the same meaning here as under U.S. copyright law. -// A "contribution" is the original software, or any additions or changes to -// the software. -// A "contributor" is any person that distributes its contribution under this -// license. -// "Licensed patents" are a contributor's patent claims that read directly on -// its contribution. -// -// 2. Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, including the -// license conditions and limitations in section 3, each contributor grants -// you a non-exclusive, worldwide, royalty-free copyright license to reproduce -// its contribution, prepare derivative works of its contribution, and -// distribute its contribution or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, including the license -// conditions and limitations in section 3, each contributor grants you a -// non-exclusive, worldwide, royalty-free license under its licensed patents to -// make, have made, use, sell, offer for sale, import, and/or otherwise dispose -// of its contribution in the software or derivative works of the contribution -// in the software. -// -// 3. Conditions and Limitations -// (A) No Trademark License- This license does not grant you rights to use any -// contributors' name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over patents that -// you claim are infringed by the software, your patent license from such -// contributor to the software ends automatically. -// (C) If you distribute any portion of the software, you must retain all -// copyright, patent, trademark, and attribution notices that are present in the -// software. -// (D) If you distribute any portion of the software in source code form, you -// may do so only under this license by including a complete copy of this -// license with your distribution. If you distribute any portion of the software -// in compiled or object code form, you may only do so under a license that -// complies with this license. -// (E) The software is licensed "as-is." You bear the risk of using it. The -// contributors give no express warranties, guarantees or conditions. You may -// have additional consumer rights under your local laws which this license -// cannot change. To the extent permitted under your local laws, the -// contributors exclude the implied warranties of merchantability, fitness for a -// particular purpose and non-infringement. - -#if STRIDE_PLATFORM_UWP -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using SharpDX.WIC; -using Stride.Core; -using WIC = SharpDX.WIC; -using Format = Stride.Graphics.PixelFormat; - -namespace Stride.Graphics -{ - public class WICHelper - { - private static WIC.ImagingFactory _factory = new ImagingFactory(); - - private static ImagingFactory Factory { get { return _factory ?? (_factory = new ImagingFactory()); } } - - //------------------------------------------------------------------------------------- - // WIC Pixel Format Translation Data - //------------------------------------------------------------------------------------- - private struct WICTranslate - { - public WICTranslate(Guid wic, Format format) - { - this.WIC = wic; - this.Format = format; - } - - public readonly Guid WIC; - public readonly Format Format; - }; - - private static readonly WICTranslate[] WICToDXGIFormats = - { - new WICTranslate(SharpDX.WIC.PixelFormat.Format128bppRGBAFloat, Format.R32G32B32A32_Float), - - new WICTranslate(SharpDX.WIC.PixelFormat.Format64bppRGBAHalf, Format.R16G16B16A16_Float), - new WICTranslate(SharpDX.WIC.PixelFormat.Format64bppRGBA, Format.R16G16B16A16_UNorm), - - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppRGBA, Format.R8G8B8A8_UNorm), - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppBGRA, Format.B8G8R8A8_UNorm), // DXGI 1.1 - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppBGR, Format.B8G8R8X8_UNorm), // DXGI 1.1 - - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppRGBA1010102XR, Format.R10G10B10_Xr_Bias_A2_UNorm), // DXGI 1.1 - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppRGBA1010102, Format.R10G10B10A2_UNorm), - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppRGBE, Format.R9G9B9E5_Sharedexp), - - new WICTranslate(SharpDX.WIC.PixelFormat.Format16bppBGRA5551, Format.B5G5R5A1_UNorm), - new WICTranslate(SharpDX.WIC.PixelFormat.Format16bppBGR565, Format.B5G6R5_UNorm), - - new WICTranslate(SharpDX.WIC.PixelFormat.Format32bppGrayFloat, Format.R32_Float), - new WICTranslate(SharpDX.WIC.PixelFormat.Format16bppGrayHalf, Format.R16_Float), - new WICTranslate(SharpDX.WIC.PixelFormat.Format16bppGray, Format.R16_UNorm), - new WICTranslate(SharpDX.WIC.PixelFormat.Format8bppGray, Format.R8_UNorm), - - new WICTranslate(SharpDX.WIC.PixelFormat.Format8bppAlpha, Format.A8_UNorm), - - new WICTranslate(SharpDX.WIC.PixelFormat.FormatBlackWhite, Format.R1_UNorm), - -#if DIRECTX11_1 - new WICTranslate(SharpDX.WIC.PixelFormat.Format96bppRGBFloat, Format.R32G32B32_Float ), - #endif - }; - - //------------------------------------------------------------------------------------- - // WIC Pixel Format nearest conversion table - //------------------------------------------------------------------------------------- - - private struct WICConvert - { - public WICConvert(Guid source, Guid target) - { - this.source = source; - this.target = target; - } - - public readonly Guid source; - public readonly Guid target; - }; - - private static readonly WICConvert[] WICConvertTable = - { - // Directly support the formats listed in XnaTexUtil::g_WICFormats, so no conversion required - // Note target Guid in this conversion table must be one of those directly supported formats. - - new WICConvert(WIC.PixelFormat.Format1bppIndexed, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format2bppIndexed, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format4bppIndexed, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format8bppIndexed, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - - new WICConvert(WIC.PixelFormat.Format2bppGray, WIC.PixelFormat.Format8bppGray), // Format.R8_UNorm - new WICConvert(WIC.PixelFormat.Format4bppGray, WIC.PixelFormat.Format8bppGray), // Format.R8_UNorm - - new WICConvert(WIC.PixelFormat.Format16bppGrayFixedPoint, WIC.PixelFormat.Format16bppGrayHalf), // Format.R16_FLOAT - new WICConvert(WIC.PixelFormat.Format32bppGrayFixedPoint, WIC.PixelFormat.Format32bppGrayFloat), // Format.R32_FLOAT - - new WICConvert(WIC.PixelFormat.Format16bppBGR555, WIC.PixelFormat.Format16bppBGRA5551), // Format.B5G5R5A1_UNorm - new WICConvert(WIC.PixelFormat.Format32bppBGR101010, WIC.PixelFormat.Format32bppRGBA1010102), // Format.R10G10B10A2_UNorm - - new WICConvert(WIC.PixelFormat.Format24bppBGR, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format24bppRGB, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format32bppPBGRA, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format32bppPRGBA, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - - new WICConvert(WIC.PixelFormat.Format48bppRGB, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format48bppBGR, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format64bppBGRA, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format64bppPRGBA, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format64bppPBGRA, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - - new WICConvert(WIC.PixelFormat.Format48bppRGBFixedPoint, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format48bppBGRFixedPoint, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format64bppRGBAFixedPoint, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format64bppBGRAFixedPoint, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format64bppRGBFixedPoint, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format64bppRGBHalf, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - new WICConvert(WIC.PixelFormat.Format48bppRGBHalf, WIC.PixelFormat.Format64bppRGBAHalf), // Format.R16G16B16A16_FLOAT - - new WICConvert(WIC.PixelFormat.Format128bppPRGBAFloat, WIC.PixelFormat.Format128bppRGBAFloat), // Format.R32G32B32A32_FLOAT - new WICConvert(WIC.PixelFormat.Format128bppRGBFloat, WIC.PixelFormat.Format128bppRGBAFloat), // Format.R32G32B32A32_FLOAT - new WICConvert(WIC.PixelFormat.Format128bppRGBAFixedPoint, WIC.PixelFormat.Format128bppRGBAFloat), // Format.R32G32B32A32_FLOAT - new WICConvert(WIC.PixelFormat.Format128bppRGBFixedPoint, WIC.PixelFormat.Format128bppRGBAFloat), // Format.R32G32B32A32_FLOAT - - new WICConvert(WIC.PixelFormat.Format32bppCMYK, WIC.PixelFormat.Format32bppRGBA), // Format.R8G8B8A8_UNorm - new WICConvert(WIC.PixelFormat.Format64bppCMYK, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format40bppCMYKAlpha, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - new WICConvert(WIC.PixelFormat.Format80bppCMYKAlpha, WIC.PixelFormat.Format64bppRGBA), // Format.R16G16B16A16_UNorm - -#if DIRECTX11_1 - new WICConvert( WIC.PixelFormat.Format32bppRGB, WIC.PixelFormat.Format32bppRGBA ), // Format.R8G8B8A8_UNorm - new WICConvert( WIC.PixelFormat.Format64bppRGB, WIC.PixelFormat.Format64bppRGBA ), // Format.R16G16B16A16_UNorm - new WICConvert( WIC.PixelFormat.Format64bppPRGBAHalf, WIC.PixelFormat.Format64bppRGBAHalf ), // Format.R16G16B16A16_FLOAT - new WICConvert( WIC.PixelFormat.Format96bppRGBFixedPoint, WIC.PixelFormat.Format96bppRGBFloat ), // Format.R32G32B32_FLOAT -#else - new WICConvert(WIC.PixelFormat.Format96bppRGBFixedPoint, WIC.PixelFormat.Format128bppRGBAFloat), // Format.R32G32B32A32_FLOAT -#endif - - // We don't support n-channel formats - }; - - /// - /// Converts a WIC to a . - /// - /// A WIC - /// A - private static Format ToDXGI(Guid guid) - { - for (int i = 0; i < WICToDXGIFormats.Length; ++i) - { - if (WICToDXGIFormats[i].WIC == guid) - return WICToDXGIFormats[i].Format; - } - - return Format.None; - } - - /// - /// Converts a to a a WIC . - /// - /// A - /// A WIC Guid. - /// True if conversion succeed, false otherwise. - private static bool ToWIC(Format format, out Guid guid) - { - for (int i = 0; i < WICToDXGIFormats.Length; ++i) - { - if (WICToDXGIFormats[i].Format == format) - { - guid = WICToDXGIFormats[i].WIC; - return true; - } - } - - // Special cases - switch (format) - { - case Format.R8G8B8A8_UNorm_SRgb: - guid = SharpDX.WIC.PixelFormat.Format32bppRGBA; - return true; - - case Format.D32_Float: - guid = SharpDX.WIC.PixelFormat.Format32bppGrayFloat; - return true; - - case Format.D16_UNorm: - guid = SharpDX.WIC.PixelFormat.Format16bppGray; - return true; - - case Format.B8G8R8A8_UNorm_SRgb: - guid = SharpDX.WIC.PixelFormat.Format32bppBGRA; - return true; - - case Format.B8G8R8X8_UNorm_SRgb: - guid = SharpDX.WIC.PixelFormat.Format32bppBGR; - return true; - } - - guid = Guid.Empty; - return false; - } - - /// - /// Gets the number of bits per pixels for a WIC Guid. - /// - /// A WIC Guid. - /// The number of bits per pixels for a WIC. If this method is failing to calculate the number of pixels, return 0. - private static int GetBitsPerPixel(Guid targetGuid) - { - using (var info = new ComponentInfo(Factory, targetGuid)) - { - if (info.ComponentType != ComponentType.PixelFormat) - return 0; - - var pixelFormatInfo = info.QueryInterfaceOrNull(); - if (pixelFormatInfo == null) - return 0; - - int bpp = pixelFormatInfo.BitsPerPixel; - pixelFormatInfo.Dispose(); - return bpp; - } - } - - - //------------------------------------------------------------------------------------- - // Returns the DXGI format and optionally the WIC pixel Guid to convert to - //------------------------------------------------------------------------------------- - private static Format DetermineFormat(Guid pixelFormat, WICFlags flags, out Guid pixelFormatOut) - { - Format format = ToDXGI(pixelFormat); - pixelFormatOut = Guid.Empty; - - if (format == Format.None) - { - for (int i = 0; i < WICConvertTable.Length; ++i) - { - if (WICConvertTable[i].source == pixelFormat) - { - pixelFormatOut = WICConvertTable[i].target; - - format = ToDXGI(WICConvertTable[i].target); - Debug.Assert(format != Format.None); - break; - } - } - } - - // Handle special cases based on flags - switch (format) - { - case Format.B8G8R8A8_UNorm: // BGRA - case Format.B8G8R8X8_UNorm: // BGRX - if ((flags & WICFlags.ForceRgb) != 0) - { - format = Format.R8G8B8A8_UNorm; - pixelFormatOut = WIC.PixelFormat.Format32bppRGBA; - } - break; - - case Format.R10G10B10_Xr_Bias_A2_UNorm: - if ((flags & WICFlags.NoX2Bias) != 0) - { - format = Format.R10G10B10A2_UNorm; - pixelFormatOut = WIC.PixelFormat.Format32bppRGBA1010102; - } - break; - - case Format.B5G5R5A1_UNorm: - case Format.B5G6R5_UNorm: - if ((flags & WICFlags.No16Bpp) != 0) - { - format = Format.R8G8B8A8_UNorm; - pixelFormatOut = WIC.PixelFormat.Format32bppRGBA; - } - break; - - case Format.R1_UNorm: - if ((flags & WICFlags.FlagsAllowMono) == 0) - { - // By default we want to promote a black & white to greyscale since R1 is not a generally supported D3D format - format = Format.R8_UNorm; - pixelFormatOut = WIC.PixelFormat.Format8bppGray; - } - break; - } - - return format; - } - - /// - /// Determines metadata for image - /// - /// The flags. - /// The decoder. - /// The frame. - /// The pixel format. - /// - /// If pixel format is not supported. - private static ImageDescription? DecodeMetadata(WICFlags flags, BitmapDecoder decoder, BitmapFrameDecode frame, out Guid pixelFormat) - { - var size = frame.Size; - - var metadata = new ImageDescription - { - Dimension = TextureDimension.Texture2D, - Width = size.Width, - Height = size.Height, - Depth = 1, - MipLevels = 1, - ArraySize = (flags & WICFlags.AllFrames) != 0 ? decoder.FrameCount : 1, - Format = DetermineFormat(frame.PixelFormat, flags, out pixelFormat) - }; - - if (metadata.Format == Format.None) - return null; - - return metadata; - } - - private static BitmapDitherType GetWICDither(WICFlags flags) - { - if ((flags & WICFlags.Dither) != 0) - return BitmapDitherType.Ordered4x4; - - if ((flags & WICFlags.DitherDiffusion) != 0) - return BitmapDitherType.ErrorDiffusion; - - return BitmapDitherType.None; - } - - - private static BitmapInterpolationMode GetWICInterp(WICFlags flags) - { - if ((flags & WICFlags.FilterPoint) != 0) - return BitmapInterpolationMode.NearestNeighbor; - - if ((flags & WICFlags.FilterLinear) != 0) - return BitmapInterpolationMode.Linear; - - if ((flags & WICFlags.FilterCubic) != 0) - return BitmapInterpolationMode.Cubic; - - return BitmapInterpolationMode.Fant; - } - - //------------------------------------------------------------------------------------- - // Decodes a single frame - //------------------------------------------------------------------------------------- - private static Image DecodeSingleFrame(WICFlags flags, ImageDescription metadata, Guid convertGUID, BitmapFrameDecode frame) - { - var image = Image.New(metadata); - - var pixelBuffer = image.PixelBuffer[0]; - - if (convertGUID == Guid.Empty) - { - frame.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - else - { - using (var converter = new FormatConverter(Factory)) - { - converter.Initialize(frame, convertGUID, GetWICDither(flags), null, 0, BitmapPaletteType.Custom); - converter.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - } - - return image; - } - - //------------------------------------------------------------------------------------- - // Decodes an image array, resizing/format converting as needed - //------------------------------------------------------------------------------------- - private static Image DecodeMultiframe(WICFlags flags, ImageDescription metadata, BitmapDecoder decoder) - { - var image = Image.New(metadata); - - Guid sourceGuid; - if (!ToWIC(metadata.Format, out sourceGuid)) - return null; - - for (int index = 0; index < metadata.ArraySize; ++index) - { - var pixelBuffer = image.PixelBuffer[index, 0]; - - using (var frame = decoder.GetFrame(index)) - { - var pfGuid = frame.PixelFormat; - var size = frame.Size; - - if (pfGuid == sourceGuid) - { - if (size.Width == metadata.Width && size.Height == metadata.Height) - { - // This frame does not need resized or format converted, just copy... - frame.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - else - { - // This frame needs resizing, but not format converted - using (var scaler = new BitmapScaler(Factory)) - { - scaler.Initialize(frame, metadata.Width, metadata.Height, GetWICInterp(flags)); - scaler.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - } - } - else - { - // This frame required format conversion - using (var converter = new FormatConverter(Factory)) - { - converter.Initialize(frame, pfGuid, GetWICDither(flags), null, 0, BitmapPaletteType.Custom); - - if (size.Width == metadata.Width && size.Height == metadata.Height) - { - converter.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - else - { - // This frame needs resizing, but not format converted - using (var scaler = new BitmapScaler(Factory)) - { - scaler.Initialize(frame, metadata.Width, metadata.Height, GetWICInterp(flags)); - scaler.CopyPixels(pixelBuffer.RowStride, pixelBuffer.DataPointer, pixelBuffer.BufferStride); - } - } - } - } - } - } - return image; - } - - //------------------------------------------------------------------------------------- - // Load a WIC-supported file in memory - //------------------------------------------------------------------------------------- - internal static Image LoadFromWICMemory(IntPtr pSource, int size, bool makeACopy, GCHandle? handle) - { - var flags = WICFlags.AllFrames; - - Image image = null; - // Create input stream for memory - using (var stream = new WICStream(Factory, new SharpDX.DataPointer(pSource, size))) - { - // If the decoder is unable to decode the image, than return null - BitmapDecoder decoder = null; - try - { - decoder = new BitmapDecoder(Factory, stream, DecodeOptions.CacheOnDemand); - using (var frame = decoder.GetFrame(0)) - { - // Get metadata - Guid convertGuid; - var tempDesc = DecodeMetadata(flags, decoder, frame, out convertGuid); - - // If not supported. - if (!tempDesc.HasValue) - return null; - - var mdata = tempDesc.Value; - - if ((mdata.ArraySize > 1) && (flags & WICFlags.AllFrames) != 0) - { - return DecodeMultiframe(flags, mdata, decoder); - } - - image = DecodeSingleFrame(flags, mdata, convertGuid, frame); - } - } - catch - { - image = null; - } - finally - { - if (decoder != null) - decoder.Dispose(); - } - } - - // For WIC, we are not keeping the original buffer. - if (image != null && !makeACopy) - { - if (handle.HasValue) - { - handle.Value.Free(); - } - else - { - Utilities.FreeMemory(pSource); - } - } - return image; - } - - //------------------------------------------------------------------------------------- - // Encodes a single frame - //------------------------------------------------------------------------------------- - private static void EncodeImage(PixelBuffer image, WICFlags flags, BitmapFrameEncode frame) - { - Guid pfGuid; - if (!ToWIC(image.Format, out pfGuid)) - throw new NotSupportedException("Format not supported"); - - frame.Initialize(); - frame.SetSize(image.Width, image.Height); - frame.SetResolution(72, 72); - Guid targetGuid = pfGuid; - frame.SetPixelFormat(ref targetGuid); - - if (targetGuid != pfGuid) - { - using (var source = new Bitmap(Factory, image.Width, image.Height, pfGuid, new SharpDX.DataRectangle(image.DataPointer, image.RowStride), image.BufferStride)) - { - using (var converter = new FormatConverter(Factory)) - { - using (var palette = new Palette(Factory)) - { - palette.Initialize(source, 256, true); - converter.Initialize(source, targetGuid, GetWICDither(flags), palette, 0, BitmapPaletteType.Custom); - - int bpp = GetBitsPerPixel(targetGuid); - if (bpp == 0) throw new NotSupportedException("Unable to determine the Bpp for the target format"); - - int rowPitch = (image.Width * bpp + 7) / 8; - int slicePitch = rowPitch * image.Height; - - var temp = Utilities.AllocateMemory(slicePitch); - try - { - converter.CopyPixels(rowPitch, temp, slicePitch); - frame.Palette = palette; - frame.WritePixels(image.Height, temp, rowPitch, slicePitch); - } - finally - { - Utilities.FreeMemory(temp); - } - } - } - } - } - else - { - // No conversion required - frame.WritePixels(image.Height, image.DataPointer, image.RowStride, image.BufferStride); - } - - frame.Commit(); - } - - private static void EncodeSingleFrame(PixelBuffer pixelBuffer, WICFlags flags, Guid guidContainerFormat, Stream stream) - { - using (var encoder = new BitmapEncoder(Factory, guidContainerFormat, stream)) - { - using (var frame = new BitmapFrameEncode(encoder)) - { - if (guidContainerFormat == ContainerFormatGuids.Bmp) - { - try - { - frame.Options.Set("EnableV5Header32bppBGRA", true); - } - catch - { - } - } - EncodeImage(pixelBuffer, flags, frame); - encoder.Commit(); - } - } - } - - //------------------------------------------------------------------------------------- - // Encodes an image array - //------------------------------------------------------------------------------------- - private static void EncodeMultiframe(PixelBuffer[] images, int count, WICFlags flags, Guid guidContainerFormat, Stream stream) - { - if (images.Length < 2) - throw new ArgumentException("Cannot encode to multiple frame. Image doesn't have multiple frame"); - - using (var encoder = new BitmapEncoder(Factory, guidContainerFormat)) - { - using (var eInfo = encoder.EncoderInfo) - { - if (!eInfo.IsMultiframeSupported) - throw new NotSupportedException("Cannot encode to multiple frame. Format is not supporting multiple frame"); - } - - encoder.Initialize(stream); - - for (int i = 0; i < Math.Min(images.Length, count); i++) - { - var pixelBuffer = images[i]; - using (var frame = new BitmapFrameEncode(encoder)) - EncodeImage(pixelBuffer, flags, frame); - } - - encoder.Commit(); - } - } - - private static Guid GetContainerFormatFromFileType(ImageFileType fileType) - { - switch (fileType) - { - case ImageFileType.Bmp: - return ContainerFormatGuids.Bmp; - case ImageFileType.Jpg: - return ContainerFormatGuids.Jpeg; - case ImageFileType.Gif: - return ContainerFormatGuids.Gif; - case ImageFileType.Png: - return ContainerFormatGuids.Png; - case ImageFileType.Tiff: - return ContainerFormatGuids.Tiff; - case ImageFileType.Wmp: - return ContainerFormatGuids.Wmp; - default: - throw new NotSupportedException("Format not supported"); - } - } - - internal static void SaveGifToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, count, WICFlags.AllFrames, ImageFileType.Gif, imageStream); - } - - internal static void SaveTiffToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, count, WICFlags.AllFrames, ImageFileType.Tiff, imageStream); - } - - internal static void SaveBmpToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, 1, WICFlags.None, ImageFileType.Bmp, imageStream); - } - - internal static void SaveJpgToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, 1, WICFlags.None, ImageFileType.Jpg, imageStream); - } - - internal static void SavePngToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, 1, WICFlags.None, ImageFileType.Png, imageStream); - } - - internal static void SaveWmpToWICMemory(PixelBuffer[] pixelBuffers, int count, ImageDescription description, Stream imageStream) - { - SaveToWICMemory(pixelBuffers, 1, WICFlags.None, ImageFileType.Wmp, imageStream); - } - - private static void SaveToWICMemory(PixelBuffer[] pixelBuffer, int count, WICFlags flags, ImageFileType fileType, Stream stream) - { - if (count > 1) - EncodeMultiframe(pixelBuffer, count, flags, GetContainerFormatFromFileType(fileType), stream); - else - EncodeSingleFrame(pixelBuffer[0], flags, GetContainerFormatFromFileType(fileType), stream); - } - - public static void Dispose() - { - Utilities.Dispose(ref _factory); - } - } -} -#endif diff --git a/sources/engine/Stride/Stride.csproj b/sources/engine/Stride/Stride.csproj index ac4882991..a29e3a2b7 100644 --- a/sources/engine/Stride/Stride.csproj +++ b/sources/engine/Stride/Stride.csproj @@ -29,8 +29,6 @@ - - diff --git a/sources/native/Stride.Native.targets b/sources/native/Stride.Native.targets index 725ef9c09..97bed04bc 100644 --- a/sources/native/Stride.Native.targets +++ b/sources/native/Stride.Native.targets @@ -28,20 +28,10 @@ .so; .a; $(AllowedOutputExtensionsInPackageBuildOutputFolder) - - - - $(StrideNativeClang) -Od - $(StrideNativeClang) -O2 - - - - - $(StrideNativeClang) -O0 -g - $(StrideNativeClang) -O3 - - - + + $(StrideNativeClang) -O0 -g + $(StrideNativeClang) -O3 + @@ -56,10 +46,6 @@ - - - - @@ -142,23 +128,6 @@ - - - - - - - - - - - - - - - - - diff --git a/sources/native/WindowsProjects/UWP/UWP.vcxproj b/sources/native/WindowsProjects/UWP/UWP.vcxproj deleted file mode 100644 index 15276e9e2..000000000 --- a/sources/native/WindowsProjects/UWP/UWP.vcxproj +++ /dev/null @@ -1,237 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - {8f5685d5-4aff-4d77-a86b-8fec5c5456a2} - DynamicLibrary - $(StrideNativeOutputName) - $(StrideNativeOutputName) - en-US - 14.0 - true - Windows Store - 10.0 - 10.0.16299.0 - 10.0 - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - true - v143 - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - true - v143 - - - DynamicLibrary - false - true - v143 - - - DynamicLibrary - false - true - v143 - - - - - - - - - - - - - - - - - - - - - - - - - - - $(StrideNativeProjectObjFolder)\ - $(IntermediateOutputPath) - $(StrideNativeOutputDir)\ - - - false - false - - - false - false - - - false - false - - - false - false - - - false - false - - - false - false - - - - NotUsing - false - - MultiThreadedDLL - Default - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\x86\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - $(StrideNativePathLibs) %(AdditionalOptions) - - - - - NotUsing - false - - MultiThreadedDLL - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\x86\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - $(StrideNativePathLibs) %(AdditionalOptions) - - - - - NotUsing - false - - MultiThreadedDLL - Default - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\ARM\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - /INCREMENTAL:NO $(StrideNativePathLibs) %(AdditionalOptions) - - - - - NotUsing - false - - MultiThreadedDLL - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\ARM\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - /INCREMENTAL:NO $(StrideNativePathLibs) %(AdditionalOptions) - - - - - NotUsing - false - - MultiThreadedDLL - Default - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\x64\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - $(StrideNativePathLibs) %(AdditionalOptions) - - - - - NotUsing - false - - MultiThreadedDLL - - - Console - false - false - $(StrideDependenciesDir)\NativePath\UWP\x64\;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) - $(StrideNativePathLibs) %(AdditionalOptions) - - - - - - - - - - - - diff --git a/sources/native/WindowsProjects/UWP/UWP.vcxproj.filters b/sources/native/WindowsProjects/UWP/UWP.vcxproj.filters deleted file mode 100644 index ad1a42783..000000000 --- a/sources/native/WindowsProjects/UWP/UWP.vcxproj.filters +++ /dev/null @@ -1,15 +0,0 @@ - - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - - \ No newline at end of file diff --git a/sources/native/WindowsProjects/UWP/dllmain.cpp b/sources/native/WindowsProjects/UWP/dllmain.cpp deleted file mode 100644 index 7ada4b828..000000000 --- a/sources/native/WindowsProjects/UWP/dllmain.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) -// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#include - -BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* lpReserved */) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} diff --git a/sources/targets/Stride.Core.PostSettings.Dependencies.targets b/sources/targets/Stride.Core.PostSettings.Dependencies.targets index b25e8777c..faf11bb31 100644 --- a/sources/targets/Stride.Core.PostSettings.Dependencies.targets +++ b/sources/targets/Stride.Core.PostSettings.Dependencies.targets @@ -65,8 +65,8 @@ ***************************************************************************************************************************** --> - - + + PreserveNewest diff --git a/sources/targets/Stride.Core.props b/sources/targets/Stride.Core.props index b064007de..a0f51db9c 100644 --- a/sources/targets/Stride.Core.props +++ b/sources/targets/Stride.Core.props @@ -11,14 +11,12 @@ net8.0-windows net8.0-android net8.0-ios - uap10.0.16299 $(StridePlatform) Windows Linux macOS - UWP Android iOS @@ -27,7 +25,6 @@ $(StridePlatform) dotnet - UWP Android iOS @@ -49,20 +46,12 @@ $([MSBuild]::Unescape('$(StridePlatforms)')) <_StridePlatforms>;$(StridePlatforms); - - - - false - false - AnyCPU - true net8.0 $(StrideRuntimeTargetFrameworks);net8.0-windows - $(StrideRuntimeTargetFrameworks);uap10.0.16299 $(StrideRuntimeTargetFrameworks);net8.0-android $(StrideRuntimeTargetFrameworks);net8.0-ios @@ -144,15 +133,6 @@ STRIDE_PLATFORM_DESKTOP - - x86 - STRIDE_PLATFORM_UWP - 6.2.12 - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - 10.0.16299.0 - false - - STRIDE_PLATFORM_MONO_MOBILE;STRIDE_PLATFORM_ANDROID @@ -192,17 +172,6 @@ Resources - - - - - - - - - - - diff --git a/sources/targets/Stride.props b/sources/targets/Stride.props index 26b9a578a..b34ff4f8e 100644 --- a/sources/targets/Stride.props +++ b/sources/targets/Stride.props @@ -20,14 +20,12 @@ Direct3D11;Direct3D12;OpenGL;OpenGLES;Vulkan $(StrideGraphicsApis.Split(';', StringSplitOptions.RemoveEmptyEntries)[0]) - Direct3D11 OpenGLES OpenGLES - false false false $(StrideDefaultGraphicsApi) @@ -65,13 +63,6 @@ STRIDE_GRAPHICS_API_VULKAN - - - $(MSBuildThisFileDirectory)..\build\project.lock.json - - @@ -80,7 +71,7 @@ - SDL + SDL $(StrideUI);WINFORMS;WPF $(DefineConstants);STRIDE_UI_SDL diff --git a/sources/tools/Stride.Graphics.RenderDocPlugin/Stride.Graphics.RenderDocPlugin.csproj b/sources/tools/Stride.Graphics.RenderDocPlugin/Stride.Graphics.RenderDocPlugin.csproj index d9c971d4e..e2a31c6e3 100644 --- a/sources/tools/Stride.Graphics.RenderDocPlugin/Stride.Graphics.RenderDocPlugin.csproj +++ b/sources/tools/Stride.Graphics.RenderDocPlugin/Stride.Graphics.RenderDocPlugin.csproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/sources/tools/Stride.ProjectGenerator/Program.cs b/sources/tools/Stride.ProjectGenerator/Program.cs index 6063f1dd1..c06424d7e 100644 --- a/sources/tools/Stride.ProjectGenerator/Program.cs +++ b/sources/tools/Stride.ProjectGenerator/Program.cs @@ -573,7 +573,6 @@ namespace Stride.ProjectGenerator case PlatformType.Linux: case PlatformType.macOS: - case PlatformType.UWP: configurations.Add("Any CPU", "Any CPU"); needDeploy = true; break; diff --git a/sources/tools/Stride.ProjectGenerator/ProjectType.cs b/sources/tools/Stride.ProjectGenerator/ProjectType.cs index 6ac6f7d80..5c650e5d9 100644 --- a/sources/tools/Stride.ProjectGenerator/ProjectType.cs +++ b/sources/tools/Stride.ProjectGenerator/ProjectType.cs @@ -6,7 +6,6 @@ namespace Stride.ProjectGenerator { Android, iOS, - UWP, Linux, macOS }