diff --git a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
index 09348b3c6..1a450eac9 100644
--- a/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
+++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
@@ -320,7 +320,12 @@
-
+
+ true
+ true
+ true
+ true
+
diff --git a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
index d236e6fcd..9649279ad 100644
--- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
+++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
@@ -100,7 +100,14 @@
-
+
+ true
+ true
+ true
+ true
+ true
+ true
+
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 19d4afc59..2fd20a89d 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -163,7 +163,11 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
// for details. Microsoft's "Display orientation sample" also gives an
// outline of how Windows treats device rotation
// (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
+#if NTDDI_VERSION > NTDDI_WIN8
+ DisplayInformation::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
+#else
DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
+#endif
}
static void
@@ -283,20 +287,13 @@ void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView)
CoreApplication::Exiting +=
ref new EventHandler(this, &SDL_WinRTApp::OnExiting);
-
- DisplayProperties::OrientationChanged +=
- ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
-
- // Register the hint, SDL_HINT_ORIENTATIONS, with SDL. This needs to be
- // done before the hint's callback is registered (as of Feb 22, 2013),
- // otherwise the hint callback won't get registered.
- //
- // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly.
- //SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight Portrait PortraitUpsideDown"); // DavidL: this is no longer needed (for SDL_AddHintCallback)
- SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
}
+#if NTDDI_VERSION > NTDDI_WIN8
+void SDL_WinRTApp::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
+#else
void SDL_WinRTApp::OnOrientationChanged(Object^ sender)
+#endif
{
#if LOG_ORIENTATION_EVENTS==1
CoreWindow^ window = CoreWindow::GetForCurrentThread();
@@ -379,6 +376,18 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window)
ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed);
#endif
+#if NTDDI_VERSION > NTDDI_WIN8
+ DisplayInformation::GetForCurrentView()->OrientationChanged +=
+ ref new TypedEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
+#else
+ DisplayProperties::OrientationChanged +=
+ ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
+#endif
+
+ // Register the hint, SDL_HINT_ORIENTATIONS, with SDL.
+ // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly.
+ SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
+
#if WINAPI_FAMILY == WINAPI_FAMILY_APP // for Windows 8/8.1/RT apps... (and not Phone apps)
// Make sure we know when a user has opened the app's settings pane.
// This is needed in order to display a privacy policy, which needs
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.h b/src/core/winrt/SDL_winrtapp_direct3d.h
index 929fd872e..6dc9a6c85 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.h
+++ b/src/core/winrt/SDL_winrtapp_direct3d.h
@@ -47,7 +47,11 @@ protected:
Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#if NTDDI_VERSION > NTDDI_WIN8
+ void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
+#else
void OnOrientationChanged(Platform::Object^ sender);
+#endif
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
void OnLogicalDpiChanged(Platform::Object^ sender);
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp
index 1b21b2f39..9ed67fd29 100644
--- a/src/render/direct3d11/SDL_render_winrt.cpp
+++ b/src/render/direct3d11/SDL_render_winrt.cpp
@@ -34,7 +34,6 @@ extern "C" {
#include
#endif
-using namespace ABI;
using namespace Windows::UI::Core;
using namespace Windows::Graphics::Display;
@@ -80,8 +79,14 @@ 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 NTDDI_VERSION > NTDDI_WIN8
+ const DisplayOrientations currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
+#else
+ const DisplayOrientations currentOrientation = DisplayProperties::CurrentOrientation;
+#endif
+
+ switch (currentOrientation) {
+
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
/* Windows Phone rotations */
case DisplayOrientations::Landscape:
@@ -104,7 +109,7 @@ D3D11_GetCurrentRotation()
return DXGI_MODE_ROTATION_ROTATE90;
#endif /* WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP */
}
-#endif
+
return DXGI_MODE_ROTATION_IDENTITY;
}
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index a8518da92..4a5301f22 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -163,7 +163,11 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
// Calculate the display size given the window size, taking into account
// the current display's DPI:
- const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi;
+#if NTDDI_VERSION > NTDDI_WIN8
+ const float currentDPI = DisplayInformation::GetForCurrentView()->LogicalDpi;
+#else
+ const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi;
+#endif
const float dipsPerInch = 96.0f;
const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
@@ -185,7 +189,11 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
mode->w = w;
mode->h = h;
mode->driverdata = driverdata;
+#if NTDDI_VERSION > NTDDI_WIN8
+ driverdata->currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
+#else
driverdata->currentOrientation = DisplayProperties::CurrentOrientation;
+#endif
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
// On Windows Phone, the native window's size is always in portrait,