Difference between revisions of "Legacy:GetKey"
From Spherical
(Created GetKey page) |
m (→Notes) |
||
Line 9: | Line 9: | ||
==Notes== | ==Notes== | ||
− | Best used with [[API:AreKeysLeft|AreKeysLeft]() since this can block all execution until a key has been encountered. | + | Best used with [[API:AreKeysLeft|AreKeysLeft]]() since this can block all execution until a key has been encountered. |
==Examples== | ==Examples== |
Latest revision as of 22:16, 20 May 2013
Returns one instance of a KEY_* constant in the internal key queue.
Contents
Usage
bool GetKey();
Notes
Best used with 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)