Skip to main content
GameDev.net gamedev.net
🔒 Locked

Input problems

Started by Lord Maz Nov 17, 2001 at 7:24 AM 0 replies 350+ views
Original Post
Lord Maz
Lord Maz
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
-Lord Maz-
Drazgal
Drazgal
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.