Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help with Keyboard Input

Author
Message
insanoflex312
13
Years of Service
User Offline
Joined: 31st Aug 2011
Location:
Posted: 1st Sep 2011 05:40
Ok, in my program, I would like to call a function everytime I press the spacebar, not continuously hold it down. For example, the user presses the space bar, and a function is called once. The user holds it down for a few seconds, and nothing happens. Then the user releases it and presses it again, causing the function to be called. I don't know how I'd go about doing this, so any nudge in the right direction would be helpful. Sorry if I insulted anyone's intelligence.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 1st Sep 2011 10:10
Introduce a boolean variable to store the last status of the space key and call the function only when it changes from false to true.

Login to post a reply

Server time is: 2024-11-19 08:24:36
Your offset time is: 2024-11-19 08:24:36