< index < 2. Console emulator < 2.3 Handling 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)
Parameter | Description |
---|---|
flush | If true, all pending keypress events are flushed from the keyboard buffer. Else, return the first available event. |
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 ...