-1

I am making a wrapper for keyboard input using Direct Input. To grab the key states, the function GetDeviceState() is called with a char buffer.

This is all well and good, but now to send key events I must iterate through the buffer and check against all the keys that were pressed. I was hoping there would be a callback instead that only passed the key codes that were pressed.

If anybody has experience with Direct Input, is iterating through the key code buffer the only way to check for key presses?

4

1 に答える 1

1

その答えは、GetDeviceData()代わりに使用することです。キーが押されたか離されたか、および押されたキーのオフセットを取得できます。これは、私が探していたものにかなり近いものです。これで、独自のコールバックを開始でき、キーが押されていない場合のオーバーヘッドは次のようになります。最小限。

于 2012-04-13T21:21:12.033 に答える