Fixed build on older Visual Studio, enable new features on newer Visual Studio
authorSam Lantinga <slouken@libsdl.org>
Wed, 22 Apr 2020 15:42:32 -0700
changeset 1377674f7ed12a32b
parent 13775 bfb4c1955bae
child 13777 ad59ca5b6092
Fixed build on older Visual Studio, enable new features on newer Visual Studio
include/SDL_config_windows.h
src/sensor/windows/SDL_windowssensor.c
     1.1 --- a/include/SDL_config_windows.h	Wed Apr 22 14:57:06 2020 -0700
     1.2 +++ b/include/SDL_config_windows.h	Wed Apr 22 15:42:32 2020 -0700
     1.3 @@ -198,7 +198,9 @@
     1.4  #define SDL_JOYSTICK_HIDAPI 1
     1.5  #define SDL_JOYSTICK_RAWINPUT   1
     1.6  #define SDL_JOYSTICK_VIRTUAL    1
     1.7 -/*#define SDL_JOYSTICK_WGI    1*/   /* This requires Windows SDK 10.0.16299.0 */
     1.8 +#if _MSC_VER >= 1911
     1.9 +#define SDL_JOYSTICK_WGI    1   /* This requires Windows SDK 10.0.16299.0 or newer */
    1.10 +#endif
    1.11  #define SDL_JOYSTICK_XINPUT 1
    1.12  #define SDL_HAPTIC_DINPUT   1
    1.13  #define SDL_HAPTIC_XINPUT   1
    1.14 @@ -222,8 +224,8 @@
    1.15  #ifndef SDL_VIDEO_RENDER_D3D
    1.16  #define SDL_VIDEO_RENDER_D3D    1
    1.17  #endif
    1.18 -#ifndef SDL_VIDEO_RENDER_D3D11
    1.19 -#define SDL_VIDEO_RENDER_D3D11  0
    1.20 +#if _MSC_VER >= 1911
    1.21 +#define SDL_VIDEO_RENDER_D3D11  1
    1.22  #endif
    1.23  
    1.24  /* Enable OpenGL support */
     2.1 --- a/src/sensor/windows/SDL_windowssensor.c	Wed Apr 22 14:57:06 2020 -0700
     2.2 +++ b/src/sensor/windows/SDL_windowssensor.c	Wed Apr 22 15:42:32 2020 -0700
     2.3 @@ -41,6 +41,13 @@
     2.4  DEFINE_GUID(IID_SensorManagerEvents, 0x9B3B0B86, 0x266A, 0x4AAD, 0xB2, 0x1F, 0xFD, 0xE5, 0x50, 0x10, 0x01, 0xB7);
     2.5  DEFINE_GUID(IID_SensorEvents, 0x5D8DCC91, 0x4641, 0x47E7, 0xB7, 0xC3, 0xB7, 0x4F, 0x48, 0xA6, 0xC3, 0x91);
     2.6  
     2.7 +/* These constants aren't available in Visual Studio 2015 or earlier Windows SDK  */
     2.8 +#if defined(_MSC_VER) && _MSC_VER <= 1900
     2.9 +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]
    2.10 +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]
    2.11 +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]
    2.12 +#endif
    2.13 +
    2.14  typedef struct
    2.15  {
    2.16      SDL_SensorID id;