GameInput for PC with NuGet
If you are using GameInput to build your PC game, please use the Microsoft.GameInput NuGet package to prepare Visual Studio for development. Doing so will only update your Visual Studio project's PC build configuration and won't make any modifications to the Xbox/console GameInput build dependencies.
Although GameInput is supported out of the box on modern versions of Windows, it is important to install the GameInput redistributable included in the NuGet package for both development and release to take advantage of the latest GameInput features and updates on PC.
GameInput Redistributable
Note
The GameInput redistributable is included in the NuGet package but is not automatically installed.
Although GameInput is supported out of the box on modern versions of Windows, PC games are required to incorporate the GameInput redistributable into their respective installers. Upon installation of the GameInput NuGet package, the GameInputRedist.msi
installer is placed into the packages\Microsoft.GameInput.<version>\redist
directory, which is usually found in your project's root directory.
If you're working with a GDK PC title, see the documentation regarding Custom installation actions for more information on how to include this package with your title upon release. If you are working with a non-GDK PC title, ensure that this redistributable is installed as part of your normal game installation.
The GameInput redistributable verifies that it won't result in a GameInput downgrade on the target system. While this does mean that your game can run on a PC with a newer version of GameInput installed than was used for development, the GameInput APIs will remain backward compatible, ensuring a consistent behavior going forward.
GameInput v.1 / PC Changes
If you are using a previous version of GameInput on PC, or sharing code with
GameInput on Xbox using the GDK, please note that many unimplemented
functions and corresponding enums and constants have been removed from the v.1 API.
Additionally, the API has been placed in the GameInput::v1
namespace
to facilitate versioning. Due to these changes, you may experience
compilation errors when building that code using this (and future)
versions. Notable changes include:
IGameInputDevice::GetDeviceInfo
previously returned the resulting IGameInputDeviceInfo struct as the function's return value. This struct is now returned as an out parameter on the function, and the function's return value is now anHRESULT
.IGameInput::UnregisterCallback
previously took a timeout value as its second parameter, however this parameter has been removed.IGameInputReading::GetSequenceNumber
has been removed. Please useIGameInputReading::GetTimestamp
instead.
In these cases, along with the touch API used for XCloud on
console, use the GAMEINPUT_API_VERSION
define to conditionally
compile (or exclude) code between PC and console.
Example:
#include <GameInput.h>
#ifndef GAMEINPUT_API_VERSION
#define GAMEINPUT_API_VERSION 0
#endif
#if GAMEINPUT_API_VERSION == 1
using namespace GameInput::v1;
#endif
...
#if GAMEINPUT_API_VERSION >= 1
device->GetDeviceInfo(&deviceInfo);
#else
deviceInfo = device->GetDeviceInfo();
#endif
Versioning Tips
- The change in the usable API surface between v.0 and v.1 is minimal, with the removal of functionality that was never implemented, along with the function signature changes above.
- The original v.0 API from the original
GameInput.h
header is still supported on PC, however that API remains static. In this case, you would continue to use the header as-is from the GDK, older NuGet package, or the Windows SDK. - No matter which version of the API you use, it is a requirement that you install the latest redistributable from the NuGet package during development, and include that redistributable (or newer) as part of your game's installation process to end users. This is where the newer GameInput runtime implementation exists, and enhances all versions of the API with things like expanded controller support, trackpad support, remote desktop support, and various other bug fixes