Browse Source

Fixed build on older Visual Studio, enable new features on newer Visual Studio

Sam Lantinga 5 years ago
parent
commit
0f374b069b
2 changed files with 12 additions and 3 deletions
  1. 5 3
      include/SDL_config_windows.h
  2. 7 0
      src/sensor/windows/SDL_windowssensor.c

+ 5 - 3
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 */

+ 7 - 0
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;