Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RavNaz

DirectInput && Keyboard woes

This topic is 5557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Haven''t got the code at home on me now, its at college, will post it tommorrow, meanwhile if anyone has any suggestions ;-)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!