Microsoft DirectInput Overview

 

Apart from providing services for devices not supported by the Microsoft® Win32® API, Microsoft® DirectInput® gives faster access to input data by communicating directly with the hardware drivers rather than relying on Microsoft® Windows® messages.

DirectInput enables an application to retrieve data from input devices even when the application is in the background. It also provides full support for any type of input device, as well as for force feedback.

Through action mapping, applications can retrieve input data without needing to know what kind of device is being used to generate it.

The extended services and improved performance of DirectInput make it a valuable tool for games, simulations, and other real-time interactive applications running under Windows.

DirectInput does not provide any advantages for applications that use the keyboard for text entry or the mouse for navigation.

What's New in DirectInput

The following are some of the new features in Microsoft DirectInput.

Action mapping

Microsoft DirectInput for Microsoft® DirectX® 8.0 introduces a major new feature: action mapping. Action mapping enables you to establish a connection between input actions and input devices that does not depend on the existence of particular device objects (such as specific buttons or axes). Action mapping simplifies the input loop and reduces the need for custom game drivers, custom device profilers, and custom configuration user interfaces in games.

New DirectInput object features

The DirectInput object is now represented by the IDirectInput8 interface. A new helper function, DirectInput8Create creates the object and retrieves this interface. IDirectInput8 has a new CLSID and cannot be obtained by calling QueryInterface on an interface to objects of the class CLSID_DirectInput used in earlier DirectX versions.

New keyboard properties

Two keyboard properties have been added: DIPROP_KEYNAME, which retrieves a localized key name, and DIPROP_SCANCODE, which retrieves the scan code.

Joystick slider data in rglSlider array

Joystick slider data, which was assigned to the Z-axis of a DIJOYSTATE or DIJOYSTATE2 structure under earlier DirectX versions, will now be found in the rglSlider array of those same structures.