GETKEY

Top  Previous  Next

Syntax

key = GETKEY

Description

A DirectInput version of the INKEY$ function. Returns the ascii value of the currently pressed key or an empty string is no key is currently being pressed.

Parameters

None

Return value

The currently pressed key.

Remarks

A screen must be open or DirectInput initialized manually before using this function. GETKEY is non-blocking so it is suitable for use in a game loop.  For raw keyboard data such as the arrow and function keys use the KEYDOWN function instead.

See Also: KEYDOWN

Example usage

a$ = GETKEY
IF a$ <> "" THEN b$ = a$
WRITETEXT 0,20,"You Pressed: " + b$