From c5c1a2c65aba4579e33c2619b24e9c8f648b6323 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Wed, 30 Apr 2014 21:07:30 -0400 Subject: [PATCH] WinRT: preliminary support for building against the Windows Phone 8.1 SDK This is a step towards supporting "Universal" Windows apps, when building for Windows Phone. SDL can now build against the Windows Phone 8.1 SDK, and apps linked to it can run, however further work and testing is required as some previously Phone-only code appears to no longer be applicable for Windows Phone 8.1. The Windows 8.1 code paths does seem to be preferable, but should probably be tested and updated on a finer-grained basis. If in doubt, use the Windows Phone 8.0 projects for now, as located in VisualC-WinRT/WinPhone80_VS2012/ TODO: - look at any Windows Phone specific code paths in SDL, and see if Phone 8.1 should use the Windows Phone code path(s), or the Windows 8.x or 8.1 paths --- .../SDL-WinRT81.Shared.vcxitems | 1 + .../SDL-WinRT81.Shared.vcxitems.filters | 3 + .../SDL-WinRT81.WindowsPhone.vcxproj | 153 ++++++++++++++++++ .../SDL-WinRT81.WindowsPhone.vcxproj.filters | 5 + src/video/winrt/SDL_winrtpointerinput.cpp | 2 +- src/video/winrt/SDL_winrtvideo.cpp | 2 +- 6 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj create mode 100644 VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj.filters diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems index 538251243..ebb509696 100644 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems @@ -184,6 +184,7 @@ + diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems.filters b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems.filters index cc7d590ed..612cc863f 100644 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems.filters +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.Shared.vcxitems.filters @@ -680,5 +680,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj new file mode 100644 index 000000000..dba75794c --- /dev/null +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj @@ -0,0 +1,153 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {48fadc0e-964d-4dab-bced-372e0ad19577} + SDL_WinRT81 + en-US + 12.0 + true + Windows Phone + 8.1 + CodeSharingDll + SDL2-WinRT81.WindowsPhone + + + + DynamicLibrary + true + v120_wp81 + + + DynamicLibrary + true + v120_wp81 + + + DynamicLibrary + false + true + v120_wp81 + + + DynamicLibrary + false + true + v120_wp81 + + + + + + + + + + + + + + + + + false + false + Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + SDL2 + + + false + false + Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + SDL2 + + + false + false + Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + SDL2 + + + false + false + Objs\$(Platform)\$(Configuration)\$(MSBuildProjectName)\ + SDL2 + + + + NotUsing + false + ..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + + + + + NotUsing + false + ..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + + + + + NotUsing + false + ..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + + + + + NotUsing + false + ..\..\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + DXGI.lib;d3d11.lib;xaudio2.lib;%(AdditionalDependencies) + + + + + + + \ No newline at end of file diff --git a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj.filters b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj.filters new file mode 100644 index 000000000..6ccd4c934 --- /dev/null +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.WindowsPhone.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp index e3afffbaa..804b0a607 100644 --- a/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/src/video/winrt/SDL_winrtpointerinput.cpp @@ -83,7 +83,7 @@ WINRT_TransformCursorPosition(SDL_Window * window, // Compute coordinates normalized from 0..1. // If the coordinates need to be sized to the SDL window, // we'll do that after. -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width; outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height; #else diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index f8ebee0f9..6c6fce026 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/src/video/winrt/SDL_winrtvideo.cpp @@ -215,7 +215,7 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode) // orientation changes. In order to compensate for this behavior, // on Windows Phone, the mode's width and height will be swapped when // the device is in a landscape (non-portrait) mode. - switch (DisplayProperties::CurrentOrientation) { + switch (driverdata->currentOrientation) { case DisplayOrientations::Landscape: case DisplayOrientations::LandscapeFlipped: {