Keyboard input (non qwerty)


#1

Is there a way to get the proper char/code out of a non-qwerty keyboard?

void keyDown( KeyEvent event ) {
if( event.getChar() == ‘a’ ) cout << “pressed q on an azerty keyboard” << endl;
}


#2

You can probably use event.getCode() and compare it to the KEY_ enum. See https://libcinder.org/docs/classcinder_1_1app_1_1_key_event.html


#3

sorry,

void keyDown( KeyEvent event ) {
if ( event.getCode() == KeyEvent::KEY_q ) quit();
}

makes the same result, key pressed needs to be ‘a’ (on an azerty keyboard)


#4

You can try using event.getNativeKeyCode() ?


#5

when ‘q’ letter pressed :

cout << event.getNativeKeyCode() << endl;
38
cout << KeyEvent::KEY_q << endl;
113