views:

71

answers:

2

DirectInput requires a lot of initialization functions and cetera to detect keyboard input, so what benefits are there to using it rather than the GetAsyncKeyState() function?

A: 

Courtesy of Wikipedia...

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.

Basically DirectInput gives you more flexibility to move away from the keyboard. If the keyboard is all you ever plan on using then there is probably no harm in using GetAsyncKeyState()

Pace
A: 

Also see http://stackoverflow.com/questions/2165230/should-i-use-directinput-or-windows-message-loop/2168023

Microsoft seem to recommend just using windows messages to handle input data where possible now.

John Burton