keys.c

This include file contains often used, simple functions related to keyboard, mouse, and joystick input. It is used by the template scripts and many other library scripts.

joy_pressed (var number)

joy2_pressed (var number)

Returns nonzero when the button with the given number (1..32) on the first resp. second joystick or navigation device is pressed.

joy_hit (var number)

Returns nonzero when the button with the given number (1..32) on the first joystick was pressed since the last joy_hit call. It can be used in a while()..wait() loop to detect the moment when the button was pressed down.

key_hit (var number)

Returns nonzero when the key with the given scan code (1..256, see key mapping) was pressed since the last key_hit call. It can be used in a while()..wait() loop to detect the moment when the key was pressed down.

key_hit (STRING* keystr)

Returns nonzero when the key belonging to given character string (f.i. "a", "f1", "esc" - see key mapping) was pressed since the last key_hit call. It can be used in a while()..wait() loop to detect the moment when the key was pressed down. A usage example can be found in the camera.c code.

mouse_drag()

Drags the engine window with the left mouse button; useful for borderless windows. Assign this function to the on_mouse_left event. A usage example can be found in the clock.c sample.

See also:

key_for_str, str_for_key, key_set, key_lastpressed, inkey, joy_buttons, key mapping

► latest version online