Legacy:AreKeysLeft

From Spherical
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