Added explicit GAMEINPUT vs. WGI vs. XINPUT preprocessor overrides (#340)

* Added explicit GAMEINPUT vs. WGI vs. XINPUT overrides

* Fixed preprocessor control define

Co-authored-by: walbourn <chuckw_walbourn@yahoo.com>
This commit is contained in:
Chuck Walbourn 2022-11-04 17:41:36 -07:00 коммит произвёл GitHub
Родитель bf7f92306e
Коммит 85b3e8423f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 51 добавлений и 12 удалений

Просмотреть файл

@ -10,31 +10,42 @@
#pragma once
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_WINDOWS_GAMING_INPUT)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#ifndef USING_GAMEINPUT
#define USING_GAMEINPUT
#endif
#elif (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) && !defined(_GAMING_DESKTOP) && !defined(__MINGW32__)
#ifndef USING_WINDOWS_GAMING_INPUT
#define USING_WINDOWS_GAMING_INPUT
#elif !defined(_XBOX_ONE)
#define USING_XINPUT
#endif
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#ifdef USING_GAMEINPUT
interface IGameInputDevice;
#ifndef _GAMING_XBOX
#pragma comment(lib,"gameinput.lib")
#endif
#elif defined(USING_WINDOWS_GAMING_INPUT)
#pragma comment(lib,"runtimeobject.lib")
#include <string>
#elif !defined(_XBOX_ONE)
#elif defined(_XBOX_ONE)
// Legacy Xbox One XDK uses Windows::Xbox::Input
#elif defined(USING_XINPUT)
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/ )
#pragma comment(lib,"xinput.lib")
#else
#pragma comment(lib,"xinput9_1_0.lib")
#endif
#endif
#include <cstdint>

Просмотреть файл

@ -10,10 +10,22 @@
#pragma once
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#ifndef USING_COREWINDOW
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_COREWINDOW)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#define USING_GAMEINPUT
#elif (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#define USING_COREWINDOW
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#if defined(USING_GAMEINPUT) && !defined(_GAMING_XBOX)
#pragma comment(lib,"gameinput.lib")
#endif
#include <cstdint>

Просмотреть файл

@ -10,10 +10,22 @@
#pragma once
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#ifndef USING_COREWINDOW
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_COREWINDOW)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#define USING_GAMEINPUT
#elif (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#define USING_COREWINDOW
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#if defined(USING_GAMEINPUT) && !defined(_GAMING_XBOX)
#pragma comment(lib,"gameinput.lib")
#endif
#include <memory>

Просмотреть файл

@ -1250,7 +1250,7 @@ void GamePad::RegisterEvents(HANDLE ctrlChanged, HANDLE userChanged) noexcept
}
#else
#elif defined(USING_XINPUT)
//======================================================================================
// XInput
@ -1602,6 +1602,10 @@ private:
GamePad::Impl* GamePad::Impl::s_gamePad = nullptr;
#else
#error Unknown GamePad implementation
#endif
#pragma endregion

Просмотреть файл

@ -49,7 +49,7 @@ namespace
#pragma region Implementations
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#ifdef USING_GAMEINPUT
#include <GameInput.h>

Просмотреть файл

@ -17,7 +17,7 @@ using namespace DirectX;
using Microsoft::WRL::ComPtr;
#pragma region Implementations
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#ifdef USING_GAMEINPUT
#include <GameInput.h>