p5_terminal_graphics
p5_terminal_graphics copied to clipboard
support for more keys
At the time of writing this is the code that deals with the keyTyped support:
terminal_read_input_vk_keys((vk_key)-> {
// in the processing source this is event.getModifiersEx();
// Not sure if 0 is always fine in our case, but for now I don't need more.
int modiefiers = 0;
char c_key = (char)vk_key;
// This can probably done better, but the KeyEvent class
// that oracle provides lacks some really usefull methods.
// For example a static method to get the char of a VK_key...
// https://stackoverflow.com/questions/62967633/get-char-of-vk-key
switch (vk_key) {
case VK_UP:
case VK_LEFT:
case VK_RIGHT:
case VK_DOWN:
c_key = CHAR_UNDEFINED;
break;
}
parent.postEvent(new KeyEvent(null, parent.millis(), KeyEvent.TYPE, modiefiers, c_key, vk_key));
});
There are so much more keys that could be supported, but at the moment I have more pressing things to do. Also I'm on a laptop right now and I don't want to assume things work the first time...