ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
DirectInput - Wikipedia, the free encyclopedia

DirectInput

From Wikipedia, the free encyclopedia

DirectInput is an API for collecting input from the user, via input devices such the mouse, keyboard, joystick or game controllers. It also provides a system for action mapping, which allows you to assign specific actions within a game to the buttons and axis on your input devices. Additionally it handles force-feedback (input/output) devices. Microsoft introduced a new input library called XInput in DirectX 9 specifically for Xbox 360 controllers.

DirectInput and XInput have 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 force feedback.
  • Through action mapping, applications can retrieve input data without needing to know what kind of device is being used to generate it.

While DirectInput is a part of the DirectX library, it has not been significantly revised since DirectX 8. It should be noted that 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.[1], and to use XInput instead of DirectInput for Xbox 360 controllers.

Contents

[edit] History

DirectInput has been part of DirectX from version 1.0. It initially offered true support for only joysticks, as the mouse and keyboard part were just a wrapper to the standard Win32 API. With DirectX version 3.0 support for keyboards and mice were added, and joystick support was improved. With DirectX 5.0, joystick support was greatly improved, including adding force feedback, increasing the number of buttons, and changed the underlying device driver model. Mouse support also increased the number of buttons seen from four to eight. In DirectX 7.0, 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 it still works with Windows 98/Me and DirectX 9. DirectX 8.0 was the last version with major changes, which included action mapping and broader support for different types of devices.

While Microsoft initially touted that DirectInput would be the way to handle all inputs, it hasn't turned out this way. Currently Microsoft doesn't recommend using DirectInput for keyboards or mice, and is pushing the newer XInput for Xbox 360 controllers.[2]

[edit] XInput

XInput is an API for "next generation" controllers, and was introduced with the launch of the Xbox 360, allowing Xbox 360 controllers to be fully functional under Windows XP SP1 and up. XInput has the advantage that it is significantly easier to program with than DirectInput. XInput is compatible with DirectX 9 and up.

[edit] DirectInput vs XInput

With DirectInput not having seen any major changes since DirectX 8, and XInput being introduced later in DirectX 9, there is some confusion on the current status and future of the two APIs. Currently, each have features the other doesn't, and neither had major updates with DirectX 10.

When using Xbox 360 Controller with their default Microsoft driver with DirectInput, there are the following limitations compared to with XInput:

  • The left and right triggers will act as a single axis, not as independent analog axes
  • The vibration effects will not be available
  • Querying for headset devices will not be available

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's 'solution' was to combine 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.[3]

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. There is at least one driver, XBCD, that gives the Xbox 360 controllers the vibration support, dead zones and (optionally) independent triggers through DirectInput. This indicates Microsoft's Xbox 360 controller driver intentionally has weaker DirectInput support, rather than due to any differences between DirectInput and XInput APIs.

The XInput API also currently has limits that DirectInput does not:

  • Supports only "next generation" controllers. This limits it basically to controllers for the Xbox 360 that also have Windows drivers. Legacy Windows controllers are not supported.
  • Maximum of four controllers at a time. This is an Xbox limit that is carried over to Windows. Although there are currently few PC games that need more than four controllers at once, this seems like an arbitrary restriction as DirectInput has no such limitation.
  • Does not support keyboards, mice, or mouse-type devices. While this mirrors Microsoft's recommendation not to use DirectInput with these devices, it is possible to use DirectInput with these devices.
  • Support for only 4 axes, 10 buttons, and 8-direction digital pad per controller, compared to DirectInput's support for 8 axes, 128 buttons, and full-range POV. (Incidentally, the number of axes and buttons XInput supports corresponds directly to the Xbox 360 controller.)

Currently, XInput is for Xbox 360 controllers, while DirectInput is for any controller.

[edit] See also

[edit] External links


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -