Graphical user interface

When you play with our particle system, soon you find that adjusting parameters by changing their values right in the code is very uncomfortable. The solution for this is adding the Graphical User Interface (GUI) to the project that shows sliders for changing the parameters using the mouse, as shown in the screenshot:

Graphical user interface

We have implemented a similar GUI in the example project 03-Particles/04-Particles. There are two new classes: Slider for a single slider and Interface for managing all the sliders.

While running the project, you can adjust all the control parameters using the mouse. Also, you can load and save parameters' settings (presets) using keys 1, 2, ... 9, and Shift + 1, Shift + 2, … Shift + 9. See the example's code for more details.

Finally, you can add to the project the capability to receive OSC network messages and control it from tablets such as iPad and VJ programs such as VDMX and Max/MSP. For details, see the Using OSC protocol section in Chapter 11, Networking.

Note

In this example, we implemented simplest GUI for demonstrating how to create custom GUIs in our projects. But, openFrameworks has a variety of ready-to-use GUI classes, which implement sliders, buttons, and checkboxes. Their values can be saved and loaded from XML files and controlled by OSC network messages. See the examples of using these classes in openFrameworks' folder examples/gui.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset