Jump to content
  • Advertisement

Archived

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

WoolyUK

One keypress in Direct Input ?

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

Hiya! Im using direct input for keyboard input in my bomberman game and it works fine except for the menu screens. I would like it to only do one thing per key press instead of it going super fast and processing one tap of the key as about 1000000 keypresses This is because when I press space in the game menu to enter the game, it starts the game and plants a bomb in my game because the key used in the game is space too! How can I make it only do one cycle for a keypress please? I only need it like this for the menu, I want it the way it is for ingame I use m_keyboard->GetDeviceState(sizeof(unsigned char[256]), (LPVOID)keystate)) and then if (KeyDown(keystate, DIK_SPACE)) to check input. Thanks for any suggestions, I hope you understand what Im trying to get it hehe Adam

Share this post


Link to post
Share on other sites
Advertisement
Create a variable that stores whether or not the key was down the previous frame, and then only respond when the key WAS down but ISN''T anymore.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!