From 0f374b069bfa212c80da4f728066bb5be4b010f4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Apr 2020 15:42:32 -0700 Subject: [PATCH] Fixed build on older Visual Studio, enable new features on newer Visual Studio --- include/SDL_config_windows.h | 8 +++++--- src/sensor/windows/SDL_windowssensor.c | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h index f7f40ae8b..6e5c2d131 100644 --- a/include/SDL_config_windows.h +++ b/include/SDL_config_windows.h @@ -198,7 +198,9 @@ typedef unsigned int uintptr_t; #define SDL_JOYSTICK_HIDAPI 1 #define SDL_JOYSTICK_RAWINPUT 1 #define SDL_JOYSTICK_VIRTUAL 1 -/*#define SDL_JOYSTICK_WGI 1*/ /* This requires Windows SDK 10.0.16299.0 */ +#if _MSC_VER >= 1911 +#define SDL_JOYSTICK_WGI 1 /* This requires Windows SDK 10.0.16299.0 or newer */ +#endif #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_XINPUT 1 @@ -222,8 +224,8 @@ typedef unsigned int uintptr_t; #ifndef SDL_VIDEO_RENDER_D3D #define SDL_VIDEO_RENDER_D3D 1 #endif -#ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#if _MSC_VER >= 1911 +#define SDL_VIDEO_RENDER_D3D11 1 #endif /* Enable OpenGL support */ diff --git a/src/sensor/windows/SDL_windowssensor.c b/src/sensor/windows/SDL_windowssensor.c index 3fa1df968..1a7007942 100644 --- a/src/sensor/windows/SDL_windowssensor.c +++ b/src/sensor/windows/SDL_windowssensor.c @@ -41,6 +41,13 @@ DEFINE_GUID(IID_SensorManager, 0xBD77DB67, 0x45A8, 0x42DC, 0x8D, 0x00, 0x6D, 0xC DEFINE_GUID(IID_SensorManagerEvents, 0x9B3B0B86, 0x266A, 0x4AAD, 0xB2, 0x1F, 0xFD, 0xE5, 0x50, 0x10, 0x01, 0xB7); DEFINE_GUID(IID_SensorEvents, 0x5D8DCC91, 0x4641, 0x47E7, 0xB7, 0xC3, 0xB7, 0x4F, 0x48, 0xA6, 0xC3, 0x91); +/* These constants aren't available in Visual Studio 2015 or earlier Windows SDK */ +#if defined(_MSC_VER) && _MSC_VER <= 1900 +DEFINE_PROPERTYKEY(SENSOR_DATA_TYPE_ANGULAR_VELOCITY_X_DEGREES_PER_SECOND, 0X3F8A69A2, 0X7C5, 0X4E48, 0XA9, 0X65, 0XCD, 0X79, 0X7A, 0XAB, 0X56, 0XD5, 10); //[VT_R8] +DEFINE_PROPERTYKEY(SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Y_DEGREES_PER_SECOND, 0X3F8A69A2, 0X7C5, 0X4E48, 0XA9, 0X65, 0XCD, 0X79, 0X7A, 0XAB, 0X56, 0XD5, 11); //[VT_R8] +DEFINE_PROPERTYKEY(SENSOR_DATA_TYPE_ANGULAR_VELOCITY_Z_DEGREES_PER_SECOND, 0X3F8A69A2, 0X7C5, 0X4E48, 0XA9, 0X65, 0XCD, 0X79, 0X7A, 0XAB, 0X56, 0XD5, 12); //[VT_R8] +#endif + typedef struct { SDL_SensorID id;