key_pressed (var number);
Checks whether a certain the
key or button with the scancode given by number (see
key mapping
) is
pressed.Parameters:
number - scancode of the key to check,
8.30 or -1 for resetting all keys to the nonpressed state.
Returns:
0 when not pressed, otherwise nonzero.
Speed:
Fast
Remarks:
- Resetting the keys can be useful when the release of keys is not detected by the operating system, for instance after hibernating or waking up from standby mode.
Example (lite-C):
// wait until [f1] is pressed
while(!key_pressed(59)) wait(1);
See also:
key_for_str, str_for_key, key_set, key_lastpressed, inkey, key mapping,
keys.c
► latest
version online