walbourn/directx-sdk-samples

XInputEnable is deprecated

cugone opened this issue · 1 comments

In the XInput samples (both BasicController and RumbleController) XInputEnable is used.

XInputEnable has been marked as deprecated for windows 10 and up. Using the function invokes non-standard-conforming behavior of emitting an error instead of a warning for deprecated attributes and/or #pragma deprecated preprocessor directives so the samples will not compile by default without disabling SDL checks:

#if(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
void WINAPI XInputEnable
(
    _In_ BOOL enable     // [in] Indicates whether xinput is enabled or disabled. 
);
#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#pragma deprecated(XInputEnable)
#endif

An alternative would be nice, as I think it's a good thing to have the ability to disable controllers when a program loses focus.

The XINputEnable function was deprecated for Windows 10 because XInput focus is already handled automatically like other input forms.

I updated the sample to capture this point in this commit.

Note you can always suppress the 4995 deprecation warning with the /sdl switch enabled.