< index < 2. Console < 2.3 Handling keyboard input | ===================================== 2.3.1 Blocking keyboard input ===================================== |

    C++ : static TCOD_key_t TCODConsole::waitForKeypress(bool flush)
    C   : TCOD_key_t TCOD_console_wait_for_keypress(bool flush)
    Py  : console_wait_for_keypress(flush)

This function waits for the user to press a key. It returns the code of the key pressed as well as the corresponding character. See TCOD_key_t.
If the flush parameter is true, every pending keypress event is discarded, then the function wait for a new keypress.
If flush is false, the function waits only if there are no pending keypress events, else it returns the first event in the keyboard buffer.

Parameter | Description
--- | ---
flush | If true, all pending keypress events are flushed from the keyboard buffer. Else, return the first available event.

Example :

    C++ : TCOD_key_t key = TCODConsole::waitForKeypress(true);
          if ( key.c == 'i' ) { ... open inventory ... }
    C   : TCOD_key_t key = TCOD_console_wait_for_keypress(true);
          if ( key.c == 'i' ) { ... open inventory ... }
    Py  : key = libtcod.console_wait_for_keypress(True)
          if key.c == ord('i') : # ... open inventory ...