Advertisement Jump to content


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


One keypress in Direct Input ?

This topic is 5895 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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!