DirectInput

"XInput" redirects here. For the X Window System XInput extension, see X Window System protocols and architecture.

In computing, DirectInput[1][2] is a deprecated Microsoft API for collecting input from a computer user, via input devices such as the mouse, keyboard, joystick or other game controllers. It also provides a system for action mapping, which allows the user to assign specific actions within a game to the buttons and axes of the input devices. Additionally it handles haptic feedback (input/output) devices. Microsoft introduced a new input library called XInput specifically for the Xbox 360 controller.

DirectInput and XInput provide benefits over normal Win32 input events:

While DirectInput forms a part of the DirectX library, it has not been significantly revised since DirectX 8 (2001–2002). Microsoft recommends that new applications make use of the Windows message loop for keyboard and mouse input instead of DirectInput (as indicated in the Meltdown 2005 slideshow[3]), and to use XInput instead of DirectInput for Xbox 360 controllers.

History

DirectX included DirectInput from version 1.0 (1995). It initially offered true support only for joysticks, as the mouse and keyboard modules simply provided wrappers to the standard Win32 API. DirectX version 3.0 (1996) added support for keyboards and mice; it also improved joystick support. DirectX 5.0 (1997) included greatly improved joystick support, including adding haptic feedback, increasing the number of buttons, changing the underlying device-driver model and incorporating a COM-based API. Mouse support also increased the number of buttons seen from four to eight. In DirectX 7.0 (1999- ), DirectInput added a long-promised feature of seeing individual mice much like individual joysticks, but the feature didn't work with the later released Windows XP, even though as of 2010 it works with Windows 98/Me and DirectX 9. DirectX 8.0 (2000), the last version with major changes, included action mapping and broader support for different types of devices.

While Microsoft initially intended that DirectInput would handle all inputs, it hasn't turned out this way. As of 2011 Microsoft doesn't recommend using DirectInput for keyboards or mice, and has started pushing the newer XInput for Xbox 360 controllers.[4] In Windows Vista, Windows 7 and later Windows versions, the in-built action mapping UI has been removed.[5] DirectInput is not available for Windows Store apps.

XInput

XInput,[6] an API for "next generation" controllers, was introduced in December 2005 alongside the launch of the Xbox 360. This instruction set provided full support for Xbox 360 controllers in Windows XP SP1 and subsequent operating systems, and is described by Microsoft as being easier to program for and requiring less setup than DirectInput. XInput is compatible with DirectX version 9 and later.

Xbox 360 Controller support

An Xbox 360 Controller, with the default Microsoft driver, has the following limitations with DirectInput, compared to XInput:

None of these limitations exist if using the Xbox 360 Controller with XInput.[7]

Vibration effects will not work on the Xbox One Controller.

According to MSDN, "the combination of the left and right triggers in DirectInput is by design. Games have always assumed that DirectInput device axes are centered when there is no user interaction with the device. However, the Xbox 360 controller was designed to register minimum value, not center, when the triggers are not being held." MSDN proffered the "solution" of combining the triggers, setting one trigger to a positive direction and the other to a negative direction, so no user interaction is indicative to DirectInput of the "control" being at center.[8]

The above, however, ignores the fact that many DirectInput controllers, such as gamepads with dual analog sticks and racing-wheel controller sets, already map triggers and pedals independently. In addition, many DirectInput devices also have vibration effects. At least one driver, XBCD, gives the Xbox 360 controllers the vibration support, dead zones and (optionally) independent triggers through DirectInput. This suggests that Microsoft's Xbox 360 controller driver intentionally has weaker DirectInput support, rather than due to any differences between DirectInput and XInput APIs. On the other hand, Xbox 360 controller and XInput support only very basic control of vibration motors[9][10] in contrast with great palette of various effects supported by DirectInput.[11]

DirectInput vs XInput

Microsoft has not made any major changes to DirectInput since DirectX 8, and introduced XInput later in DirectX 9: there remains some confusion about the current status and future of the two APIs.

The XInput API also as of 2010 has limits that DirectInput does not:

As of 2011 XInput is for Xbox 360 controllers, while DirectInput is for any controller. In XInput 1.4 introduced with Windows 8 support of querying for headset devices was reintroduced.[13]

See also

References

  1. https://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx
  2. https://msdn.microsoft.com/en-us/library/windows/desktop/bb318766(v=vs.85).aspx
  3. "Meltdown 2005 slideshow (.zip)". Retrieved 2012-11-13.
  4. "Taking Advantage of High-Definition Mouse Movement". MSDN. Microsoft. Retrieved 2009-01-25.
  5. "DirectInput ConfigureDevices in Windows Vista". Web.archive.org. 2008-12-27. Archived from the original on December 27, 2008. Retrieved 2012-11-13.
  6. http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
  7. http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx
  8. "XInput and DirectInput". Microsoft. 2012-09-17. Retrieved 2012-12-27.
  9. "Gamepad - Rumbler Control". Free60 Project. Archived from the original on 2009-03-13. Retrieved 2009-01-25.
  10. "XINPUT_VIBRATION". Msdn.microsoft.com. Retrieved 2009-01-25.
  11. "DIEFFECT". MSDN. Microsoft. Retrieved 2009-01-25.
  12. "DirectInput". MSDN. Microsoft. Retrieved 2010-05-30.
  13. "XInputGetAudioDeviceIds function". MSDN. Retrieved 10 December 2013.

External links

This article is issued from Wikipedia - version of the 10/26/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.