Archived

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

Lord Maz

Input problems

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