The keyboard events are handled by the
keyPressed(int key) and
keyReleased(int key) functions, which are called by openFrameworks when a key is pressed and released respectively. The
key input argument holds the numerical code of the key. Let's implement handling key pressings in our project and use it to add some desirable features: hiding GUI, saving screenshots, and saving/loading presets.
We consider here only key pressing events. Handling key releasing is implemented in a similar way.
In order to capture the image generated with our project, we need to be able to hide the GUI from the screen. To achieve this, let's define the Boolean variable
showGui, implement its toggling by pressing Z, and use its ...