Marcin Ignac

SimpleGUI

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.

Features v0.1

Download

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?

  1. Go to GitHub and download the source code
  2. Unpack it and copy SimpleGUI to your CINDER_PATH/blocks/ folder
  3. Create new project
  4. Add references to SimpleGUI folder. In XCode just right click on your project name in Files view and choose Add->Existing files...
  5. 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.

gui->draw();

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.

blog comments powered by Disqus