Legacy:GetKey
From Spherical
Returns one instance of a KEY_* constant in the internal key queue.
Contents
Usage
bool GetKey();
Notes
Best used with [[API:AreKeysLeft|AreKeysLeft]() since this can block all execution until a key has been encountered.
Examples
Blocking execution from continuing. It'll count each time you hit a random key.
var font = GetSystemFont();
for (var i = 0; i < 10; ++i) {
font.drawText(0, 0, i);
FlipScreen();
GetKey();
}
It can also be used to clear the key buffer.
while (AreKeysLeft()) GetKey();
See also
- AreKeysLeft()
- GetSystemFont()
- FlipScreen()
- font.drawText(x, y, text)