Jump to content
  • Advertisement


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

Lord Maz

Input problems

This topic is 6150 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, I''ve had this problem a long time and for some reason it''s not mentioned too often.. The problem is repetion of input, for example I want a exit message when pressing the ESC button and it should wait for another ESC press before it quits - but when I do this I never get a chance to see the message because it''s too fast.. any idea how to get only one message for every time the button is down? A tutorial link would be great

Share this post

Link to post
Share on other sites
There are a few methods you can use, one is to have a timer set when escape is pressed then dont recognise escape been pressed for another hafl a second or so, for example

if(Escape is pressed)
If(GetTickCount() - Timer > 500)
Timer = GetTickCount()
Record an escape press
end if
end if

Or you could use the WM_KEYDOWN message on the windows message handler to record an escape press but dont let it record another escape press til it detects a WM_KEYUP message for the escape key.

Hope that helps!

Ballistic Programs

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!