From 641ba09975659ac3bd5d8bf1df40e637e3f012a1 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 12 Mar 2014 07:26:07 -0700 Subject: [PATCH] Fixed compiling Windows RT code on Visual Studio 2013 --- VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj | 13 ++--- .../SDL/SDL-WinRT_VS2012.vcxproj.filters | 10 ++-- src/core/winrt/SDL_winrtapp_xaml.cpp | 1 + src/joystick/winrt/SDL_xinputjoystick.c | 2 +- src/render/direct3d11/SDL_render_d3d11.c | 2 +- ..._winrthelpers.cpp => SDL_render_winrt.cpp} | 47 ++++++++++--------- ..._winrthelpers_cpp.h => SDL_render_winrt.h} | 0 src/video/winrt/SDL_winrtevents.cpp | 2 +- src/video/winrt/SDL_winrtmouse.cpp | 1 - src/video/winrt/SDL_winrtopengles.cpp | 2 +- src/video/winrt/SDL_winrtpointerinput.cpp | 2 +- 11 files changed, 39 insertions(+), 43 deletions(-) rename src/render/direct3d11/{SDL_render_d3d11_winrthelpers.cpp => SDL_render_winrt.cpp} (70%) rename src/render/direct3d11/{SDL_render_d3d11_winrthelpers_cpp.h => SDL_render_winrt.h} (100%) diff --git a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj index cc5fddd7b3946..70553a471d29c 100644 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj @@ -97,16 +97,10 @@ - - true - true - true - true - true - true - + + @@ -285,10 +279,11 @@ - + + diff --git a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters index fb3195f913000..be690eb42b7c8 100644 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters @@ -280,9 +280,8 @@ Source Files - - Source Files - + + @@ -639,9 +638,8 @@ Source Files - - Source Files - + + diff --git a/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/core/winrt/SDL_winrtapp_xaml.cpp index 67a5cddea88cc..5b129d142ca9d 100644 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -42,6 +42,7 @@ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE; #if WINAPI_FAMILY == WINAPI_FAMILY_APP +extern "C" ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL; static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; #endif diff --git a/src/joystick/winrt/SDL_xinputjoystick.c b/src/joystick/winrt/SDL_xinputjoystick.c index 1bb91b27257fa..649f7cbe9b86c 100644 --- a/src/joystick/winrt/SDL_xinputjoystick.c +++ b/src/joystick/winrt/SDL_xinputjoystick.c @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" +#include "../../SDL_internal.h" #if SDL_JOYSTICK_XINPUT diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 58673d465445e..e7777572261b7 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -35,7 +35,7 @@ #ifdef __WINRT__ -#include "SDL_render_d3d11_winrthelpers_cpp.h" +#include "SDL_render_winrt.h" #if WINAPI_FAMILY == WINAPI_FAMILY_APP #include diff --git a/src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp b/src/render/direct3d11/SDL_render_winrt.cpp similarity index 70% rename from src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp rename to src/render/direct3d11/SDL_render_winrt.cpp index 25e6765e92a1a..5753beb540a0f 100644 --- a/src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp +++ b/src/render/direct3d11/SDL_render_winrt.cpp @@ -28,12 +28,15 @@ extern "C" { } #include -#include +#include #if WINAPI_FAMILY == WINAPI_FAMILY_APP #include #endif +#include "SDL_render_winrt.h" + +using namespace ABI; using namespace Windows::UI::Core; using namespace Windows::Graphics::Display; @@ -75,32 +78,32 @@ D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer) extern "C" DXGI_MODE_ROTATION D3D11_GetCurrentRotation() { +#if 0 /* FIXME: This doesn't compile on Visual Studio 2013 */ switch (DisplayProperties::CurrentOrientation) { #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - /* Windows Phone rotations */ - case DisplayOrientations::Landscape: - return DXGI_MODE_ROTATION_ROTATE90; - case DisplayOrientations::Portrait: - return DXGI_MODE_ROTATION_IDENTITY; - case DisplayOrientations::LandscapeFlipped: - return DXGI_MODE_ROTATION_ROTATE270; - case DisplayOrientations::PortraitFlipped: - return DXGI_MODE_ROTATION_ROTATE180; + /* Windows Phone rotations */ + case DisplayOrientations::Landscape: + return DXGI_MODE_ROTATION_ROTATE90; + case DisplayOrientations::Portrait: + return DXGI_MODE_ROTATION_IDENTITY; + case DisplayOrientations::LandscapeFlipped: + return DXGI_MODE_ROTATION_ROTATE270; + case DisplayOrientations::PortraitFlipped: + return DXGI_MODE_ROTATION_ROTATE180; #else - /* Non-Windows-Phone rotations (ex: Windows 8, Windows RT) */ - case DisplayOrientations::Landscape: - return DXGI_MODE_ROTATION_IDENTITY; - case DisplayOrientations::Portrait: - return DXGI_MODE_ROTATION_ROTATE270; - case DisplayOrientations::LandscapeFlipped: - return DXGI_MODE_ROTATION_ROTATE180; - case DisplayOrientations::PortraitFlipped: - return DXGI_MODE_ROTATION_ROTATE90; + /* Non-Windows-Phone rotations (ex: Windows 8, Windows RT) */ + case DisplayOrientations::Landscape: + return DXGI_MODE_ROTATION_IDENTITY; + case DisplayOrientations::Portrait: + return DXGI_MODE_ROTATION_ROTATE270; + case DisplayOrientations::LandscapeFlipped: + return DXGI_MODE_ROTATION_ROTATE180; + case DisplayOrientations::PortraitFlipped: + return DXGI_MODE_ROTATION_ROTATE90; #endif /* WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP */ - - default: - return DXGI_MODE_ROTATION_UNSPECIFIED; } +#endif + return DXGI_MODE_ROTATION_IDENTITY; } diff --git a/src/render/direct3d11/SDL_render_d3d11_winrthelpers_cpp.h b/src/render/direct3d11/SDL_render_winrt.h similarity index 100% rename from src/render/direct3d11/SDL_render_d3d11_winrthelpers_cpp.h rename to src/render/direct3d11/SDL_render_winrt.h diff --git a/src/video/winrt/SDL_winrtevents.cpp b/src/video/winrt/SDL_winrtevents.cpp index 112c3d49409cd..c27c7084b40fa 100644 --- a/src/video/winrt/SDL_winrtevents.cpp +++ b/src/video/winrt/SDL_winrtevents.cpp @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" +#include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_WINRT diff --git a/src/video/winrt/SDL_winrtmouse.cpp b/src/video/winrt/SDL_winrtmouse.cpp index e3cd284fd808f..fdfbcf94a433e 100644 --- a/src/video/winrt/SDL_winrtmouse.cpp +++ b/src/video/winrt/SDL_winrtmouse.cpp @@ -18,7 +18,6 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_WINRT diff --git a/src/video/winrt/SDL_winrtopengles.cpp b/src/video/winrt/SDL_winrtopengles.cpp index 1229eb9bfcd86..b0bf37a33f5f8 100644 --- a/src/video/winrt/SDL_winrtopengles.cpp +++ b/src/video/winrt/SDL_winrtopengles.cpp @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" +#include "../../SDL_internal.h" // TODO: WinRT, make this file compile via C code diff --git a/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp index 13dd5b621528b..cf8dfd9608e32 100644 --- a/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/src/video/winrt/SDL_winrtpointerinput.cpp @@ -18,7 +18,7 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_config.h" +#include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_WINRT