Legacy:GetKey

From Spherical
Revision as of 22:16, 20 May 2013 by Radnen (talk | contribs) (Created GetKey page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Returns one instance of a KEY_* constant in the internal key queue.

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