Legacy:AreKeysLeft

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


Returns true if there are keys left, false if otherwise. "keys left" in this case means: are there any unprocessed keys in the internal key queue?

Usage

bool AreKeysLeft();


Notes

Best used in a loop to capture input.

Examples

Handling key presses:

while (AreKeysLeft()) {
    switch (GetKey()) {
        case KEY_ENTER:
            // do something on enter.
        break;
        case KEY_ESCAPE:
            // do something on escape.
        break;
        case KEY_SPACE:
            // do something on space.
        break;
    }
}

It can also be used to clear the key buffer.

while (AreKeysLeft()) GetKey();


See also