
03-25-2007, 11:12 PM
|
|
Registered User
|
 |
Join Date: Apr 2006
Posts: 755
|
|
Keydown event? (Not onKeyPressed)
|
I'm trying to find a way to detect when a key is pushed down, and not when it's pressed (onKeyPressed). The effect would basically be the same as onKeyPressed, but without the auto-repeat most operating systems implements.
From searching the forums, I've found that onKeyDown and onKeyUp apparently can be used in GUI controls, but none of them works in a standard "weapon". (Declaring onKeyUp() and KeyUp())
My goal is to call a function when a key is tapped twice within a specified timespan. At first I did this with onKeyPressed and timevar2, but previously mentioned auto-repeat messed that up, calling the function repeatedly when the button was held down.
As an alternative, I thought about checking for the keys in onTimeout(), but the way I constructed it, it would limit the timespan to a minimum of 0.1. (Not allowing the player to double press faster than that) |
|
|
|