• Advertisement

Archived

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

Keyboard Input

This topic is 6566 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

Hi ya - I''m having problems with getting data from the keyboard. When I press a key down and release, it print that character it prints a bunch of them. How do I get it so that it recognizes the button is pressed down and only one character should be printed. Im using GetDeviceState. and sending it to a char[]. Thanks all

Share this post


Link to post
Share on other sites
Advertisement
I am guessing that you are checking the state each frame? If you are, then that is why it is showing so many of them. It checks so fast, that the key is still down before it hits the next frame. The only thing off the top of my head would to somehow only check once ever few frames, or a timer to see how long the key has been pressed. What I mean is...think in windows. If you hold a key down, it displays the key, waits, and then begins repeating. You would need to implement that waiting period to see if the user really means to hold down the key. Hope this helps.

BASSOFeeSH
><>

Share this post


Link to post
Share on other sites
You should use Buffered Input !
There you get exact description of when which key was pressed or released.

-crent-

Share this post


Link to post
Share on other sites

  • Advertisement