Testing for function keys in Processing 3.3.7

I am developing a “simple” game based around the QueasyCam library. So far, I have implemented terrain generation and a skydome. The things I will put in next are player movement, third-person capability, surface physics checking, etc. But, for some features, like toggleable fullscreen, I need to be able to check if the user pressed a function key, i.e. F5 to toggle third-person, F11 to toggle fullscreen.

I understand key, keyCode, keyPressed, keyPressed(), keyReleased(), keyClicked(), etc. However, none of them mention capability of checking the function keys. Does anyone know a solution for this? Or rather, should I opt for toggling certain features through other keys, that key and keyCode are shown to know in documentation?


1 Like
void settings(){

void setup(){


void draw(){

void keyPressed(){


I tried in Win10 and alt/ctrl/shift respond to 18,17,16 for keyCode and key is set to ?

For F5 and F11 I get 116 and 122, same for key I get ?.

Not sure if this is valid cross platform. If you do a bit of research in the Java world, you should get an idea as it is very likely it will apply to Processing too.


So, the function keys are detected by keyPressed() and keyReleased(), that’s nice. So now two options:

  1. Test the key codes for all 12 normal function keys, and create constants for them.
  2. Use the processing constants for those function keys, if such constants exist.

You should check previous related posts: https://discourse.processing.org/search?q=multiple%20keys