Device properties
Applications that need to know specific details about a device can access the device’s GameInputDeviceInfo structure. This structure contains a wealth of information about the device, but there are a few things to understand about using it. Device information can be big - sometimes 10 KB or more. For efficiency reasons, the GameInput API doesn’t make a copy of the device data, but instead temporarily grants applications direct access to the data stored internally within GameInput. This approach favors high-performance code by avoiding buffer allocations and large memory transfers, because applications often are interested only in some small portion of the data. This also enables the GameInputDeviceInfo structure to contain nested pointers to other regions within the device info data block where various supporting arrays of information can be found, without adding the complexity of variable-sized output and deep copies.Device IDs
One important piece of information available in the device info is the device’s application-local device ID. This is a special 32-byte value that uniquely identifies the device, even across restarts of the application or reboots of the system. This ID is also stable across disconnects and reconnects of wireless devices, and wired USB devices as long as they are plugged back into the same USB port. The app-local device ID is most commonly used to identify specific devices beyond the lifetime of the application. For example, a game with an input-mapping UI can use the device ID to ensure the user’s input configuration is applied to the same devices each time the app starts. This is especially important for applications that support complex mappings across multiple devices that may otherwise appear identical (for example, a set of homogenous instrument panel devices for a flight simulator).Device enumeration
While most applications should never need it, GameInput does support explicit enumeration of connected devices. This can be performed via the IGameInput interface’s RegisterDeviceCallback method.Aggregate devices
When multiple keyboards are connected at the same time, most input APIs present the input to applications in a combined way, as if all the input came from a single virtual system keyboard. (The same also applies to mice.) GameInput, however, normally exposes each device and its input individually. This opens up a lot of possibilities - for example, being able to tell which user’s chatpad is generating input in a local multiplayer game - but it also adds a lot of complexity to applications that don’t require this functionality. To address this, GameInput supports the concept of aggregate devices. The CreateAggregateDevice method on the IGameInput interface allows applications to create a virtual IGameInputDevice instance that exposes the combined input from all devices for a single GameInputKind. This aggregate device can then be used as a filter to other GameInput API functions to interact with the aggregate device (for example, retrieving readings). While this is most commonly used for keyboard and mouse input, it can also be used with most other types of input.In the current release,
CreateAggregateDevice isn’t yet implemented. —>Reference API documentation
- GameInput (API contents)
- Structures
