XInput
   HOME

TheInfoList



OR:

In computing, DirectInput is a legacy
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washin ...
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
for collecting input from a computer user, via input devices such as the mouse,
keyboard Keyboard may refer to: Text input * Keyboard, part of a typewriter * Computer keyboard ** Keyboard layout, the software control of computer keyboards and their mapping ** Keyboard technology, computer keyboard hardware and firmware Music * Musi ...
, or a
gamepad A gamepad is a type of video game controller held in two hands, where the fingers (especially thumbs) are used to provide input. They are typically the main input device for video game consoles. Features Gamepads generally feature a set o ...
. 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 The Xbox 360 controller is the primary game controller for Microsoft's Xbox 360 home video game console that was introduced at E3 2005. The Xbox 360 controller comes in both wired and wireless versions. The Xbox controller is not compatible with ...
. DirectInput and XInput provide benefits over normal Win32 input events: * they enable an application to retrieve data from input devices even when the application is in the background * they provide full support for any type of input device, as well as for ''haptic feedback'' * through ''action mapping'', applications can retrieve input data without needing to know what kind of device generated that input 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), 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 The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
. 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 An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
. 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 Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
, even though 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, this didn't work out. Microsoft no longer recommends using DirectInput for keyboards or mice, and has started pushing the newer XInput for Xbox 360 controllers. In
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
,
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
and later Windows versions, the in-built action mapping UI has been removed. DirectInput is not available for Windows Store apps.


XInput

XInput, an
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
for "next generation" controllers, was introduced in December 2005 alongside the launch of the
Xbox 360 The Xbox 360 is a home video game console developed by Microsoft. As the successor to the original Xbox, it is the second console in the Xbox series. It competed with Sony's PlayStation 3 and Nintendo's Wii as part of the seventh generati ...
. This specification provided support for Xbox 360 controllers in
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
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 The Xbox 360 controller is the primary game controller for Microsoft's Xbox 360 home video game console that was introduced at E3 2005. The Xbox 360 controller comes in both wired and wireless versions. The Xbox controller is not compatible with ...
'', with the default Microsoft driver, has the following limitations with DirectInput, compared to XInput: * the left and right triggers will act as a single axis representing the signed difference between the triggers, not as independent analog axis * vibration effects will not operate * querying for headset devices will not operate, XInput 1.4 as part of Windows 8 introduced Xbox headset support. According to
MSDN Microsoft Developer Network (MSDN) was the division of Microsoft responsible for managing the firm's relationship with developers and testers, such as hardware developers interested in the operating system (OS), and software developers developing ...
, "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. The above, however, ignores the fact that many DirectInput controllers, such as
gamepad A gamepad is a type of video game controller held in two hands, where the fingers (especially thumbs) are used to provide input. They are typically the main input device for video game consoles. Features Gamepads generally feature a set o ...
s with dual analog sticks and racing-wheel controller sets, already map triggers and
pedals A pedal (from the Latin '' pes'' ''pedis'', "foot") is a lever designed to be operated by foot and may refer to: Computers and other equipment * Footmouse, a foot-operated computer mouse * In medical transcription, a pedal is used to control ...
independently. In addition, many DirectInput devices also have vibration effects. At least one 3rd-party driver, XBCD, gives the Xbox 360 controllers the vibration support, dead zones and (optionally) independent analog/digital triggers through DirectInput its XInput driver possesses. This suggests that Microsoft's Xbox 360 controller driver was given ''intentionally'' weaker DirectInput support, rather than due to any differences between DirectInput and XInput APIs. On the other hand, Xbox 360 controllers using XInput support only very basic control of vibration motors in contrast with greater palette of effects supported via DirectInput.


DirectInput vs XInput

Advantages of DirectInput over XInput: * XInput supports only controllers that work with the Microsoft Xbox console * XInput supports a maximum of four controllers at a time. DirectInput has no such limit * XInput does not support keyboards, mice, or mouse-type devices. While this mirrors Microsoft's recommendation not to use DirectInput with these devices, programmers can use DirectInput with these devices. * XInput supports maximum of 4 axes, 10 buttons, 2 triggers and 8-direction digital pad per controller, compared to DirectInput's support for 8 axes, 128 buttons, and full-range POV. (The number of axes, buttons and triggers XInput supports corresponds directly to the Xbox 360 controller.) Advantages of XInput over DirectInput: * Currently supported by Microsoft


References


External links


Microsoft's DirectInput documentation

XInput and DirectInput
{{DEFAULTSORT:Directinput Input DirectInput