This commit is contained in:
jklawreszuk 2024-09-14 15:17:32 +02:00
Родитель c21272cc5b
Коммит 625d4af238
130 изменённых файлов: 31 добавлений и 4960 удалений

Просмотреть файл

@ -1,2 +1,2 @@
set StridePlatforms=Windows;UWP;Android;iOS;Linux
set StridePlatforms=Windows;Android;iOS;Linux
Stride.sln

Просмотреть файл

@ -1,2 +0,0 @@
set StridePlatforms=Windows;UWP
Stride.Runtime.sln

Просмотреть файл

@ -92,7 +92,7 @@ Example of use:
</Target>
<!--
Build Stride: Windows, Android, iOS, Windows 10 (UWP)
Build Stride: Windows, Android, iOS
-->
<Target Name="Clean">
<Exec Command="RMDIR /Q /S $(StrideRoot)\Bin"/>
@ -185,15 +185,6 @@ Example of use:
<MSBuild Targets="Build" Projects="$(StrideSolution).iOS.sln" Properties="$(BuildProperties);StridePlatforms=iOS;StrideSkipAutoPack=true;StrideSkipUnitTests=true"/>
</Target>
<Target Name="BuildUWP">
<PropertyGroup>
<StrideSolution>$(StrideSolution).Runtime</StrideSolution>
<StridePlatforms>UWP</StridePlatforms>
</PropertyGroup>
<MSBuild Targets="Restore" Projects="$(MSBuildThisFileFullPath)" Properties="StridePlatforms=$(StridePlatforms);StrideSolution=$(StrideSolution)"/>
<MSBuild Targets="Build" Projects="$(StrideSolution).sln" Properties="$(BuildProperties);StridePlatforms=$(StridePlatforms);StrideSkipAutoPack=true;StrideSkipUnitTests=true"/>
</Target>
<Target Name="BuildWindowsVulkan">
<MSBuild Targets="Restore" Projects="$(MSBuildThisFileFullPath)" Properties="StridePlatforms=$(StridePlatforms);StrideSolution=$(StrideSolution).Runtime;StrideGraphicsApis=Vulkan"/>
<MSBuild Targets="Build" Projects="$(StrideSolution).Runtime.sln" Properties="$(BuildProperties);StrideGraphicsApis=Vulkan;StrideSkipAutoPack=true;StrideSkipUnitTests=true"/>

3
deps/BulletPhysics/UWP/ARM/libbulletc.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e66db69a02c1d423dc5dd01354129c459b9f6207ee4f94e4f81ebe7bc671c10c
size 1321472

3
deps/BulletPhysics/UWP/x64/libbulletc.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3216d1b3ee9829fdb1eba3d007f36ef22f2fd32f5af7b8c62262ab874037cd5
size 1835520

3
deps/BulletPhysics/UWP/x86/libbulletc.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d10abaf888b6d62b6f792b13984af90b7f4948dea6893b75d81763979be0ea6
size 1605632

3
deps/NativePath/UWP/ARM/Detour.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:681cd1b79152993198be30c9f2775d4ac42cff4ac5c94ec43369baae5e94683d
size 86948

3
deps/NativePath/UWP/ARM/Recast.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bca2e4a5193fd0d092572e2bd7fea64bb669b9bb5e18b1130bcbf80f65c7158c
size 131760

3
deps/NativePath/UWP/ARM/libCelt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c539591353b0699f107f3b316ffb47a27078ad8f14351df6c4e065aeac5346ee
size 128102

3
deps/NativePath/UWP/ARM/libCompilerRt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ee12921b100599a4f0175e310beae8c78e99105103cc76884be23ff77d4b475
size 100602

3
deps/NativePath/UWP/ARM/libNativePath.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ecba0f1f0184957128a8103390f601679bbf388b64ec2adb69a29883b4051c2
size 965946

3
deps/NativePath/UWP/x64/Detour.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e5aa31cc874045666b65723df029896b45c192eef8f78f88be70af344e35af8b
size 137198

3
deps/NativePath/UWP/x64/Recast.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:edf28e661a99dc08ac80b4f4eeda267cdd3fd692ddda6ec1cc645b1d005a6fd5
size 250276

3
deps/NativePath/UWP/x64/libCelt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fb95b3b8143e4273e252ccf4ce8c80625022603e8333678d21e81a11cae2518f
size 209544

3
deps/NativePath/UWP/x64/libCompilerRt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3b160fc69b348bb3251de3d4fcdedc933bf5455d13ec6f0932f3db53e079143
size 136992

3
deps/NativePath/UWP/x64/libNativePath.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5fe3da1c87cbeace07db41e6b53f4165e6079b16c1a69b5299fe0c44e5522af6
size 935704

3
deps/NativePath/UWP/x86/Detour.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:659b79943f4eb2b45051f3ccec02df4cd1c178b55804ca5860f199d8f88c333e
size 112966

3
deps/NativePath/UWP/x86/Recast.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0b65f503483f5bd5b08b0285e399c9c44602b18177773b9c790f50bb30f2771
size 202526

3
deps/NativePath/UWP/x86/libCelt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b454d45945ca912a221d3a173c68e322a196a7350d7d53baf4d29678e6f54057
size 179866

3
deps/NativePath/UWP/x86/libCompilerRt.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:35c276ddb54da74b7318f75abda8e0f6827f76a2e26b5380bf5f2057f1f0254f
size 127910

3
deps/NativePath/UWP/x86/libNativePath.lib поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34dee8da53e831040e58e43c50a62cbafed0ba23204f96c054b11c80509f4cdf
size 932924

1
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

3
deps/freetype/UWP/ARM/freetype.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a09e3e55f0a281f0b314978fc2f2f672c99bfbb2e6dca6680c35602f869e95c
size 391680

3
deps/freetype/UWP/ARM/freetype.pdb поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4486b7e189f427fcc5c514abe9aec707b6f840c45688159b4212df7e7d9a72e7
size 2387968

3
deps/freetype/UWP/x64/freetype.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f62b9561d8f29cd67dab70d626bc940f48ccde52d08bac296bd35c484f710820
size 573952

3
deps/freetype/UWP/x64/freetype.pdb поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9909872d149a4259b46bc4abd7682cf8a8b639cea819dfa1f07a066b50129bc1
size 2404352

3
deps/freetype/UWP/x86/freetype.dll поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2ceca2ae9425906e2fe119b42aa4602bf43a8d4ca761e7706dee2d14fbc78b4e
size 464384

3
deps/freetype/UWP/x86/freetype.pdb поставляемый
Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c02365ce580c66c8e670c34d55d0bb8aafe799e1d35fa993254b651ea45ff739
size 2592768

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b67c53b92ee7560552d8cc3d87a6ede45c0455b757b68f3127308e5e607a679e
size 133120

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:079a5d03b84bab78cc451b148163e2a224738e87a609f74d5bf0c77681b306ee
size 139776

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a5d4c9d21a84bec3583626218e7abbca921a125cc7f0ae95d62e997a99e3149e
size 115200

Просмотреть файл

@ -165,16 +165,8 @@
<RemoveDir Condition="Exists('$(StrideCompileAssetOutputPath)')" ContinueOnError="true" Directories="$(StrideCompileAssetOutputPath)"/>
</Target>
<!-- UWP: Adjust Appx folders -->
<PropertyGroup Condition="'$(StrideIsExecutable)' == 'true' And '$(StridePlatform)' == 'UWP'">
<!-- Use OutputPath to define AppxPackage directory -->
<AppxPackageDir>$(OutputPath)\$(AppxPackageDirName)\</AppxPackageDir>
<AppxPackageTestDir>$(AppxPackageDir)Test\</AppxPackageTestDir>
<AppxPackageName>$(AssemblyName)</AppxPackageName>
</PropertyGroup>
<!-- UWP & iOS: Compile and Transform Assets into Content during PrepareResources phase -->
<PropertyGroup Condition="'$(StrideIsExecutable)' == 'true' And ('$(StridePlatform)' == 'UWP' Or '$(StridePlatform)' == 'Android')">
<!-- iOS: Compile and Transform Assets into Content during PrepareResources phase -->
<PropertyGroup Condition="'$(StrideIsExecutable)' == 'true' And '$(StridePlatform)' == 'Android'">
<PrepareResourcesDependsOn>
_StrideDeployAssetsAsContent;
$(PrepareResourcesDependsOn)

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -28,7 +28,6 @@
<ProjectReference Include="..\Stride.Core\Stride.Core.csproj">
<PrivateAssets>contentfiles;analyzers</PrivateAssets>
</ProjectReference>
<PackageReference Include="SharpDX" Condition="'$(TargetFramework)' == '$(StrideFrameworkUWP)'" />
</ItemGroup>
<Import Project="$(StrideSdkTargets)" />

Просмотреть файл

@ -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

Просмотреть файл

@ -14,12 +14,6 @@ namespace Stride.Core
/// </summary>
public static class Platform
{
#if STRIDE_PLATFORM_UWP
/// <summary>
/// The current running <see cref="PlatformType"/>.
/// </summary>
public static readonly PlatformType Type = PlatformType.UWP;
#else
/// <summary>
/// The current running <see cref="PlatformType"/>.
/// </summary>
@ -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
/// <summary>
/// Gets a value indicating whether the running platform is windows desktop.

Просмотреть файл

@ -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

Просмотреть файл

@ -45,11 +45,6 @@ namespace Stride.Core
iOS,
#pragma warning restore SA1300 // Element must begin with upper-case letter
/// <summary>
/// The Universal Windows Platform (UWP).
/// </summary>
UWP,
/// <summary>
/// The Linux OS.
/// </summary>

Просмотреть файл

@ -15,7 +15,6 @@
<StrideAssemblyProcessorOptions>--auto-module-initializer --serialization</StrideAssemblyProcessorOptions>
<StrideBuildTags>*</StrideBuildTags>
<RestorePackages>true</RestorePackages>
<ExtrasUwpMetaPackageVersion>6.2.12</ExtrasUwpMetaPackageVersion>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -26,7 +26,6 @@
-->
<PropertyGroup>
<!-- Default mappings -->
<StridePlatform Condition="'$(StridePlatform)' == '' And '$(TargetPlatformIdentifier)' == 'UAP'">UWP</StridePlatform>
<StridePlatform Condition="'$(StridePlatform)' == '' And '$(TargetPlatformIdentifier)' == 'Android'">Android</StridePlatform>
<StridePlatform Condition="'$(StridePlatform)' == '' And '$(TargetPlatformIdentifier)' == 'iOS'">iOS</StridePlatform>
<StridePlatform Condition="'$(StridePlatform)' == '' And '$(TargetPlatformIdentifier)' == 'macOS'">macOS</StridePlatform>
@ -177,19 +176,6 @@
</ItemGroup>
</Target>
<Target Name="_StrideSetupNativeLibrariesUWP" DependsOnTargets="_StrideBuildDependencies" AfterTargets="ResolveAssemblyReferences" Condition="'$(StridePlatform)' == 'UWP'">
<PropertyGroup>
<StrideCPU Condition="'$(Platform)' == 'x86'">x86</StrideCPU>
<StrideCPU Condition="'$(Platform)' == 'x64'">x64</StrideCPU>
<StrideCPU Condition="'$(Platform)' == 'ARM'">ARM</StrideCPU>
</PropertyGroup>
<ItemGroup>
<Content Include="@(_StrideDependencyNativeLib)" Condition="$([System.String]::Copy('%(_StrideDependencyNativeLib.Link)').StartsWith('$(StrideCPU)'))">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link Condition="'$(StrideCPU)' != ''">$([System.String]::Copy('%(_StrideDependencyNativeLib.Link)').Replace('$(StrideCPU)\', ''))</Link>
</Content>
</ItemGroup>
</Target>
<Target Name="_StrideSetupNativeLibrariesAndroid" DependsOnTargets="_StrideBuildDependencies" AfterTargets="ResolveAssemblyReferences" Condition="'$(StridePlatform)' == 'Android'">
<ItemGroup>
<AndroidNativeLibrary Include="@(_StrideDependencyNativeLib)"/>

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e153c15bff3544be86cc386c2bc964715de579940b3e789cc6b66fbdb1aff525
size 400

Просмотреть файл

@ -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) { #>
<uap:InitialRotationPreference>
<uap:Rotation Preference="<#= orientation #>" />
</uap:InitialRotationPreference>
<# } #>

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8df9a7eb201c9b5791689d772536d19b8ca49f28f6080f21d5fd55122bfc2637
size 2143

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:87a685d6c49d6b28347a1abf8330949d4736945b2899b6ddfaf322245c818450
size 2942

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:42531391f97e2b92c8f8544d9a7fbbb1f46500024dcf06bf38b4ca1713ef337f
size 6207

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7b695ff9bbedee79816e06e31194bb52643a9a791ffdd84ed193ea9830fbd237
size 1170

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6ca2cd25cc79acc4b39cc1c7c927e3bc1ee4deb66a2ca86fe43002b903592663
size 1282

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dcd9915e836c286f69e20039d450c77c4370593d299c1c5d129659db752b1ee3
size 1850

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9fe96890fd8f6bf612efec69844b8b89be31bd5f02fe4df67ce01f4b6882aa84
size 25455

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a15881fa169c3339fa0daa542104aa8177e6ae6e4e4ab6949a2620173f0f3e50
size 10821

Просмотреть файл

@ -1,74 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{<#= ProjectGuid.ToString().ToUpperInvariant() #>}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace><#= Properties.Namespace #></RootNamespace>
<AssemblyName><#= Properties.PackageName #></AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile><#= ProjectName #>.TemporaryKey.pfx</PackageCertificateKeyFile>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
<#@ include file="..\..\Common.PropertyGroups.targets.t4" #>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0">
<Name>Microsoft Visual C++ 2015 Runtime Package for Windows Universal</Name>
</SDKReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\<#= Properties.ProjectGameRelativePath #>">
<Project>{<#= Properties.ProjectGameGuid #>}</Project>
<Name><#= Properties.PackageGameAssemblyName #></Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="App.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="<#= ProjectName #>.TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\Logo.scale-200.png" />
<Content Include="Assets\SmallLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\StoreLogo.scale-200.png" />
<Content Include="Assets\Logo.scale-100.png" />
<Content Include="Assets\SmallLogo.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\StoreLogo.scale-100.png" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -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()
{
}
}
}
}

Просмотреть файл

@ -1,15 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp rescap">
<#@ include file="..\Package.appxmanifest.common.t4" #>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="expandedResources" />
</Capabilities>
</Package>

Просмотреть файл

@ -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}

Просмотреть файл

@ -1,38 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<# var identityGuid = System.Guid.NewGuid(); #>
<Identity
Name="<#= identityGuid.ToString().ToLowerInvariant() #>"
Publisher="CN=MyCompany"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="<#= identityGuid.ToString().ToLowerInvariant() #>" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName><#= Properties.PackageGameDisplayName #></DisplayName>
<PublisherDisplayName>publisher</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="<#= Properties.PackageGameNameShort #>"
Executable="$targetnametoken$.exe"
EntryPoint="<#= Properties.Namespace #>.App">
<uap:VisualElements
DisplayName="<#= Properties.PackageGameDisplayName #>"
Square150x150Logo="Assets\Logo.png"
Square44x44Logo="Assets\SmallLogo.png"
Description="<#= Properties.PackageGameName #>"
BackgroundColor="#464646">
<uap:SplashScreen Image="Assets\SplashScreen.png" />
<#@ include file="..\Common.UWP.targets.t4" #>
</uap:VisualElements>
</Application>
</Applications>

Просмотреть файл

@ -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")]

Просмотреть файл

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

Просмотреть файл

@ -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 #>
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
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();
}
}
}
}

Просмотреть файл

@ -1,14 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<Page
x:Class="<#= Properties.Namespace #>.<#= Properties.PackageGameNameShort #>MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:<#= Properties.Namespace #>"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<SwapChainPanel x:Name="SwapChainPanel" />
</Grid>
</Page>

Просмотреть файл

@ -1,90 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{<#= ProjectGuid.ToString().ToUpperInvariant() #>}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace><#= Properties.Namespace #></RootNamespace>
<AssemblyName><#= Properties.PackageName #></AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile><#= ProjectName #>.TemporaryKey.pfx</PackageCertificateKeyFile>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>
<#@ include file="..\..\Common.PropertyGroups.targets.t4" #>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0">
<Name>Microsoft Visual C++ 2015 Runtime Package for Windows Universal</Name>
</SDKReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\<#= Properties.ProjectGameRelativePath #>">
<Project>{<#= Properties.ProjectGameGuid #>}</Project>
<Name><#= Properties.PackageGameAssemblyName #></Name>
</ProjectReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.12" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="<#= Properties.PackageGameNameShort #>MainPage.xaml.cs">
<DependentUpon><#= Properties.PackageGameNameShort #>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="<#= ProjectName #>.TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\Logo.scale-200.png" />
<Content Include="Assets\SmallLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\StoreLogo.scale-200.png" />
<Content Include="Assets\Logo.scale-100.png" />
<Content Include="Assets\SmallLogo.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\StoreLogo.scale-100.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="<#= Properties.PackageGameNameShort #>MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -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 #>
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
/// <summary>
/// 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().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += this.OnSuspending;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
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();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
// TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Просмотреть файл

@ -1,9 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<Application
x:Class="<#= Properties.Namespace #>.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:<#= Properties.Namespace #>"
RequestedTheme="Dark">
</Application>

Просмотреть файл

@ -1,13 +0,0 @@
<#@ template inherits="ProjectTemplateTransformation" language="C#" #>
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<#@ include file="..\Package.appxmanifest.common.t4" #>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

Просмотреть файл

@ -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}

Просмотреть файл

@ -487,18 +487,6 @@
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="{x:Static data:ConfigPlatforms.UWP}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#03A9F4" Geometry="M 20 25 L 6 25 L 6 37.074219 L 20 38.992188 Z "/>
<GeometryDrawing Brush="#03A9F4" Geometry="M 20 9.101563 L 6 11.066406 L 6 23 L 20 23 Z "/>
<GeometryDrawing Brush="#03A9F4" Geometry="M 22 8.820313 L 22 23 L 42 23 L 42 6.011719 Z "/>
<GeometryDrawing Brush="#03A9F4" Geometry="M 22 25 L 22 39.269531 L 42 42.011719 L 42 25 Z "/>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ImageFetchEntity" >
<DrawingImage.Drawing>
<DrawingGroup>

Просмотреть файл

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e153c15bff3544be86cc386c2bc964715de579940b3e789cc6b66fbdb1aff525
size 400

Просмотреть файл

@ -1339,18 +1339,6 @@
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="{x:Static core:PlatformType.UWP}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#03A9F4" Geometry="M 20 25 L 6 25 L 6 37.074219 L 20 38.992188 Z " />
<GeometryDrawing Brush="#03A9F4" Geometry="M 20 9.101563 L 6 11.066406 L 6 23 L 20 23 Z " />
<GeometryDrawing Brush="#03A9F4" Geometry="M 22 8.820313 L 22 23 L 42 23 L 42 6.011719 Z " />
<GeometryDrawing Brush="#03A9F4" Geometry="M 22 25 L 22 39.269531 L 42 42.011719 L 42 25 Z " />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<!-- Build icons -->
<DrawingImage x:Key="ImageBuildProject">
<DrawingImage.Drawing>

Просмотреть файл

@ -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 },

Просмотреть файл

@ -45,7 +45,6 @@ namespace Stride.Assets
switch (platformType)
{
case PlatformType.Windows:
case PlatformType.UWP:
return GraphicsPlatform.Direct3D11;
case PlatformType.Android:
case PlatformType.iOS:

Просмотреть файл

@ -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;

Просмотреть файл

@ -35,12 +35,6 @@ namespace Stride.Assets
{ VS2015Version, @"MSBuild\Xamarin\Android\Xamarin.Android.CSharp.targets" }
};
internal static readonly Dictionary<Version, string> UniversalWindowsPlatformComponents = new Dictionary<Version, string>
{
{ 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("<NoWarn>;2008</NoWarn>");
uwpPlatform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
uwpPlatform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
uwpPlatform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");
uwpPlatform.Configurations["Release"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
uwpPlatform.Configurations["Testing"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
uwpPlatform.Configurations["AppStore"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
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()
{

Просмотреть файл

@ -250,7 +250,6 @@ namespace Stride.Assets.Textures
}
break;
case PlatformType.Windows:
case PlatformType.UWP:
case PlatformType.Linux:
case PlatformType.macOS:
switch (parameters.GraphicsPlatform)

Просмотреть файл

@ -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"

Просмотреть файл

@ -1,7 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<StrideNativePathLibsWindows>libCompilerRt.lib libCelt.lib</StrideNativePathLibsWindows>
<StrideNativePathLibsUWP>libCompilerRt.lib libCelt.lib Xaudio2.lib</StrideNativePathLibsUWP>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -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
/// <summary>
/// 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).
/// </summary>
ConnectThenListen = 3,
}

Просмотреть файл

@ -48,9 +48,6 @@ namespace Stride.Games.Testing
case PlatformType.iOS:
platformName = "iOS";
break;
case PlatformType.UWP:
platformName = "UWP";
break;
default:
platformName = "";
break;

Просмотреть файл

@ -102,13 +102,9 @@ namespace Stride.Games
{
get
{
#if STRIDE_PLATFORM_UWP
return "Stride Game";
#else
var assembly = Assembly.GetEntryAssembly();
var productAttribute = assembly?.GetCustomAttribute<AssemblyProductAttribute>();
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
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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<SwapChainPanel>
{
// 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)};
/// <inheritDoc/>
public GameContextUWPXaml(SwapChainPanel control, int requestedWidth = 0, int requestedHeight = 0)
: base (control ?? new SwapChainPanel(), requestedWidth, requestedHeight)
{
ContextType = AppContextType.UWPXaml;
}
}
public class GameContextUWPCoreWindow : GameContext<CoreWindow>
{
/// <inheritDoc/>
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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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<SharpDX.DXGI.Device3>())
{
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<GraphicsDeviceInformation> 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

Просмотреть файл

@ -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
{
/// <summary>
/// <see cref="GameWindow"/> implementation for UWP. Handles both <see cref="SwapChainPanel"/> and <see cref="CoreWindow"/>.
/// </summary>
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;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="GameWindow" /> is visible.
/// </summary>
/// <value><c>true</c> if visible; otherwise, <c>false</c>.</value>
public override bool Visible
{
get
{
return visible;
}
set
{
}
}
/// <inheritdoc/>
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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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;

Просмотреть файл

@ -5,7 +5,7 @@
</PropertyGroup>
<Import Project="..\..\targets\Stride.props" />
<PropertyGroup>
<StridePlatformFilter>Windows;Android;iOS;Linux;macOS;UWP</StridePlatformFilter>
<StridePlatformFilter>Windows;Android;iOS;Linux;macOS</StridePlatformFilter>
<DefineConstants>$(DefineConstants);XAMCORE_2_0</DefineConstants>
<StrideAssemblyProcessor>true</StrideAssemblyProcessor>
<StridePlatformDependent>true</StridePlatformDependent>

Просмотреть файл

@ -48,16 +48,6 @@ namespace Stride.Games
/// </summary>
Android,
/// <summary>
/// Game running on UWP in a Xaml SwapChainPanel.
/// </summary>
UWPXaml,
/// <summary>
/// Game running on UWP in a CoreWindow.
/// </summary>
UWPCoreWindow,
#pragma warning disable SA1300 // Element must begin with upper-case letter
/// <summary>
/// Game running on iOS in a iPhoneOSGameView.

Просмотреть файл

@ -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<Factory2>();
#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

Просмотреть файл

@ -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<SwapChain2>();
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<ISwapChainPanelNative>(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<SharpDX.DXGI.Device2>())
{
// 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<SharpDX.DXGI.Factory2>())
// 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
/// <summary>
/// Create the SwapChain on Windows.
/// </summary>
@ -509,7 +422,6 @@ namespace Stride.Graphics
return flags;
}
#endif
/// <summary>
/// Flip model does not support certain format, this method ensures it is in a supported format.

Просмотреть файл

@ -44,9 +44,9 @@
<ProjectReference Include="..\Stride.Shaders\Stride.Shaders.csproj" />
<ProjectReference Include="..\Stride\Stride.csproj" />
<PackageReference Include="System.Memory" />
<PackageReference Include="SharpDX.Direct3D11" Condition="'$(TargetFramework)' == '$(StrideFramework)' Or '$(TargetFramework)' == '$(StrideFrameworkUWP)'" />
<PackageReference Include="SharpDX.Direct3D11" Condition="'$(TargetFramework)' == '$(StrideFramework)'" />
<PackageReference Include="SharpDX.Direct3D12" Condition="'$(TargetFramework)' == '$(StrideFramework)'" />
<PackageReference Include="SharpDX.D3DCompiler" Condition="'$(TargetFramework)' == '$(StrideFramework)' Or '$(TargetFramework)' == '$(StrideFrameworkUWP)'" />
<PackageReference Include="SharpDX.D3DCompiler" Condition="'$(TargetFramework)' == '$(StrideFramework)'" />
<PackageReference Include="Vortice.Vulkan" Condition="'$(TargetFramework)' == '$(StrideFramework)'" />
<PackageReference Include="Silk.NET.OpenGL" Condition="'$(TargetFramework)' == '$(StrideFramework)'" />
<PackageReference Include="Silk.NET.OpenGLES" />

Просмотреть файл

@ -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<Device3>();
IDirect3DDevice d3DInteropDevice = null;
// Acquire the DXGI interface for the Direct3D device.
using (var dxgiDevice = d3DDevice.QueryInterface<SharpDX.DXGI.Device3>())
{
// 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

Просмотреть файл

@ -3,7 +3,6 @@
<PropertyGroup>
<!-- Defaults for CPU and GraphicsApi based on platform-->
<StrideDefaultGraphicsApi Condition="'$(StridePlatform)' == 'Windows'">Direct3D11</StrideDefaultGraphicsApi>
<StrideDefaultGraphicsApi Condition="'$(StridePlatform)' == 'UWP'">Direct3D11</StrideDefaultGraphicsApi>
<StrideDefaultGraphicsApi Condition="'$(StridePlatform)' == 'Android'">OpenGLES</StrideDefaultGraphicsApi>
<StrideDefaultGraphicsApi Condition="'$(StridePlatform)' == 'iOS'">OpenGLES</StrideDefaultGraphicsApi>
<StrideDefaultGraphicsApi Condition="'$(StridePlatform)' == 'Linux'">OpenGL</StrideDefaultGraphicsApi>

Просмотреть файл

@ -62,7 +62,7 @@ namespace Stride.Input
/// <param name="largeLeft">The large left side motor</param>
/// <param name="largeRight">The large right side motor</param>
/// <remarks>Values range from 0 to 1, where 0 is off and 1 is maximum vibration</remarks>
/// <remarks>Currently vibration is only supported on windows for XInput devices and UWP supported gamepads</remarks>
/// <remarks>Currently vibration is only supported on windows for XInput devices</remarks>
void SetVibration(float smallLeft, float smallRight, float largeLeft, float largeRight);
}
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -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;

Просмотреть файл

@ -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
{
/// <summary>
/// UWP Gamepad
/// </summary>
internal class GamePadUWP : GamePadDeviceBase
{
internal Gamepad Gamepad;
private readonly double[] lastAxisState = new double[6];
private GamePadState state = new GamePadState();
private Dictionary<GamepadButtons, GamePadButton> buttonMap = new Dictionary<GamepadButtons, GamePadButton>
{
[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<InputEvent> 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<GamePadButtonEvent>.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<GamePadAxisEvent>.GetOrCreate(this);
axisEvent.Value = (float)newValue;
axisEvent.Axis = axis;
state.Update(axisEvent);
return axisEvent;
}
}
}
#endif

Просмотреть файл

@ -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
{
/// <summary>
/// Input source for devices using the universal windows platform
/// </summary>
internal class InputSourceUWP : InputSourceBase
{
private const uint DesiredSensorUpdateIntervalMs = (uint)(1f / InputManager.DesiredSensorUpdateRate * 1000f);
private readonly Dictionary<Gamepad, GamePadUWP> gamePads = new Dictionary<Gamepad, GamePadUWP>();
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

Просмотреть файл

@ -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<VirtualKey, Keys> mapKeys;
private readonly CoreWindow uiControl;
static KeyboardUWP()
{
mapKeys = new Dictionary<VirtualKey, Keys>();
// 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

Просмотреть файл

@ -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

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше