Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenFrameworks Essentials
  • Table Of Contents Toc
  • Feedback & Rating feedback
OpenFrameworks Essentials

OpenFrameworks Essentials

By : Denis Perevalov
5 (7)
close
close
OpenFrameworks Essentials

OpenFrameworks Essentials

5 (7)
By: Denis Perevalov

Overview of this book

If you are a programmer, visual artist, or designer with experience in creative coding, and want to use openFrameworks to create fun, stunning, and interactive applications, this is the book for you. Basic knowledge of programming languages, such as C++, Java, Python, or JavaScript, will be enough to proceed with the book.
Table of Contents (13 chapters)
close
close
12
Index

Handling keyboard events

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.

Tip

We consider here only key pressing events. Handling key releasing is implemented in a similar way.

Hiding the GUI

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 value to decide whether we should draw gui on the screen:

  1. Add the variable definition to the ofApp class:
    bool showGui;
  2. Next, set up its starting value in setup():
    showGui = true;
  3. Now, implement its toggling by inserting the following command...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
OpenFrameworks Essentials
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon