GameInput is a next-generation input API that exposes input devices of all kinds through a single consistent interface.
GameInput is a next-generation input API designed to provide developers with a unified interface for accessing and managing input from various devices. It simplifies the process of handling keyboards, mice, gamepads, sensors, and other controllers through a consistent programming model.
Key Features:
Consistent Interface: GameInput exposes all input devices through a single unified model, making it easier to manage diverse hardware with minimal code changes.
High Performance: Built on a direct memory access (DMA) architecture, the API ensures low latency and efficient resource usage, ideal for time-sensitive applications like gaming.
Advanced Haptics & Sensors: Supports advanced haptic feedback and integrates with Windows sensor data for enhanced device interaction.
Ease of Use: Most common input tasks can be implemented with just a few lines of code, reducing development complexity.
Cross-Platform Support: Available on Xbox via the GDK and PC via NuGet, supporting older versions of Windows back to 19H1.
Audience & Benefit:
Ideal for game developers and input system integrators seeking to streamline device management. GameInput enables faster development cycles, improved performance, and a better user experience by supporting a wide range of devices with minimal overhead. It can be installed via winget for easy setup on supported platforms.
GameInput is a next-generation input API that exposes input devices of all kinds through a single consistent interface. It's designed with a simple programming model that makes it easy to use. GameInput is built from the ground up for the best possible performance. Key features of the GameInput API are as follows.
Overview
Availability:
GameInput is available on Xbox via the GDK and PC via NuGet. Older versions of Windows going back to Windows 10 19H1 (May 2019 update) are supported.
Consistency:
GameInput exposes input from keyboards, mice, gamepads, and other game controllers via a single unified input model, synchronized to a common time base. The code for handling input from these devices is nearly identical, using many of the same functions but with different filters applied. This makes it easy to add support for additional input devices, without major changes to input code.
Functionality:
GameInput is a functional superset of all legacy input APIs—XInput, DirectInput, Raw Input, Human Interface Device (HID), and WinRT APIs—in addition to adding new features of its own. GameInput's functionality ranges from simple fixed-format gamepad state to detailed low-level raw device access. Input can be obtained via polling or callbacks in an event-driven way. Haptics and force feedback are fully supported, and third-party device SDKs can easily be written on top of GameInput to provide access to custom device features.
Performance:
GameInput is built around an entirely new direct memory access (DMA) architecture for the lowest possible input latency and resource usage. Nearly all API functions are lock-free with strict performance guarantees, while still being 100 percent thread-safe. This makes them safe to call from time-sensitive contexts such as render threads. Advanced applications can take direct control of scheduling GameInput's internal asynchronous work queues, controlling which thread does the work and how often.
Usability
GameInput was designed with ease of use as a top priority. Most common input tasks can be implemented with just a few lines of code.
Version History
Version 2.0
Added support for advanced haptics for audio-driven devices including the PlayStation®5 DualSense® controller.
Added support for sensors supported by the Windows sensor stack.
Added support for DirectInput driver DirectInputEscape call.
Added support for running GameInput in the WINE environment on Linux-based systems.
Added support for optional background gamepad input across gamepad drivers.
Added revisionNumber, hardwareVersion, firmwareVersion, and containerId to GameInputDeviceInfo.
Fixed GIP devices reporting incorrect PNP paths in GameInputDeviceInfo.
Fixed an issue where GIP devices would not report raw readings in older versions of the API.
Increased API version to 2.
"PlayStation" is a registered trademark or trademark of Sony Interactive Entertainment Inc.
"DualSense" is a registered trademark or trademark of Sony Interactive Entertainment Inc.
Version 1.2
Fix inverted axis mapping on multiple controllers.
Fix two second timeout on process shutdown for games that leak the IGameInput instance.
GameInput will now automatically reconnect to the GameInput service when it is upgraded.
Increase the callback backlog to provide more time for games to process GameInput notifications.
Version 1.1
Applications no longer have to call CoInitialize.
Fixed missing device disconnect notifications.
Fixed FindDeviceFromId method not returning requested device.
Fixed compiler compatibility issues in header.
Stability and performance improvements.
Version 1.0
Added support for reading callbacks.
Added support for trackpads.
Added support for absolute mouse coordinates.
Added support for remote sessions.
Exposed additional device information, including PnP path and display name.
Removed deprecated APIs, fields, and constants.
While this version of GameInput is applicable to PC only, 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. 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 an HRESULT.
IGameInput::UnregisterCallback previously took a timeout value as its second parameter, however this parameter has been removed. In these two 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.
IGameInputReading::GetSequenceNumber has been removed. Please use IGameInputReading::GetTimestamp instead.