Exemple #1
0
char getch() {
	int key = KEY_UNKNOWN;

	while (key == KEY_UNKNOWN) {
		key = kb_get_last_key();
	}

	kb_discard_last_key();

	return kb_key_to_ascii(key);
}
Exemple #2
0
char kb_get_printable_key(bool shift, enum keys key)
{
    char c = kb_key_to_ascii(key);
    if(c >= 0) {
        if(shift && c >= 'a' && c <= 'z')
            c -= 0x20;
        else if(shift && c == '\'')
            c = '"';

        return c;
    }

    return -1;
}