SimpleGUI is a new code block developed by me for Cinder library. It's simple set of GUI widgets to speed up testing of your applications. It was inspired by ControlP5 library for Processing and I already used it for projects like Cindermedusae, Dualism or Pattern.
- float, int, and color sliders with configurable min and max values
- boolean radio buttons with support for groups
- buttons with click listeners
- miniature texture previews
- multicolumn layout
- config file loading and saving
- easy to change color scheme
All the source code together with examples is available as part of my MowaLibs in GitHub repo: github.com/vorg/MowaLibs
How to use it?
- Go to GitHub and download the source code
- Unpack it and copy SimpleGUI to your CINDER_PATH/blocks/ folder
- Create new project
- Add references to SimpleGUI folder. In XCode just right click on your project name in Files view and choose Add->Existing files...
- Now it's time to do a little bit of programming
Include header file and add sgui namespace.
include SimpleGUI.h using namespace mowa::sgui;
Declare pointer to SimpleGUI and some variables you want to control.
SimpleGUI* gui; float rotation; int size; ColorA color;
In the setup() function create new SimpleGUI object passing pointer to the main App that will be used for event handling.
gui = new SimpleGUI(this);
Next step is to add one label and some parameters with min, max and default values.
gui->addLabel("CONTROLS"); gui->addParam("Rotation", &rotation, 0, 360, 0); gui->addParam("Size", &size, 100, 600, 200);
SimpleGUI supports olso RGBA color sliders.
gui->addParam("Color", &color, ColorA(0,0.5,1,0.5));
Last step is to draw the gui at the end of your draw() function.
If you have any doubts there are three examples in the repository that you can use for reference.
Updated: In the latest example I show how to use buttons and texture previews.