DirectInput && Keyboard woes

Started by
4 comments, last by RavNaz 21 years ago
Has anybody ever had problems with Directnput and the keyboard, more specifically: When doing a getdevicestate, the keyboardInputBuffer[] (buffer holding the 256 states of keys) doesn''t seem to get updated. First I clear the buffer, then I Poll the keyboard followed by getdevicestate, but it always seems to report that ENTER has been pressed. What I want is for the user to press ENTER on a menu for redefining keys, and then scanning the buffer to detect another ENTER press to assign ENTER to some action. Hope this makes sense. Thanks in advance.
Advertisement
I don''t know immedietly what the fault is, because I have used DI to a limited extent. Still though, could you post your device initialization and update code? If anybody else know the problem at once, feel free to override this post.
Haven''t got the code at home on me now, its at college, will post it tommorrow, meanwhile if anyone has any suggestions ;-)
I could be wrong but it sounds like youre having the same problem that I had when first using DirectInput. It comes from the fact that you are using immediate data instead of buffered data. When you press down a key, that key is going to be detected as being in the down state for as long as you hold it down, which may end up being several frames even after a short press, meaning that it detects the button being "pressed" (if youre using the keydown macro) multiple times. Use buffered data instead (GetDeviceData) and check when the key is DE-pressed.
Nice one! Will try that tommorow.
That''s what I thought too, but it still sounds strange the device only detects the Enter key.

This topic is closed to new replies.

Advertisement