ofxSimpleGui - The world simplest Gui

I wanted to make the worlds simplest GUI, and here it is… Download now.

In your xcode project addons folder you need:
ofxSimpleGui (to be downloaded)
ofxTodd (random utils I use)

(in testApp.h)

//make a GUI object  
ofxSimpleGui		GUI;  
//a variable to control  
float radius;  

(in setup)

GUI.setTitle("Simple GUI") //you can name the gui  
GUI.addSlider("Radius", &radius, 0.0, 200.0, 0);  

Thats it :slight_smile:

no other calls to make. Poco takes care of the rest. You do need the latest poco version OF to use this addon.

  1. name of variable
  2. pass a reference to the variable
  3. set the min (changes if a float or int ie: 1 = int 1.0 = float)
  4. optional put the xml id. If you call setFromXML(…) the value will be set automatically if found in the xml file
addSlider("Name", &float_int, min, max, xmlID);  
addToggle("Name", &bool, xmlID);  


I will be adding more and fixing some things. There are a couple of crappy parts.

How to setup the xml file:

<!-- ------------- TOGGLES ----------- -->  
<!-- ------------- SLIDERS F --------- -->  
        <name>Fade In Rate</name>  
<!-- ---------- SLIDERS I ------------ -->  
        <name>Min Blob Size</name>  

thanks vanderlin! I will check that out since I was to lazy to get the other gui to run. made some trouble for me somehow. the example works buf setting up some quick sliders was pain.- So I will definately try yours!

BTW: what is poco?

This approach to a simple gui is great.

I can’t decide whether to try and edit yours / stiwis classes, or just extend theos.

In the ‘gui wishlist’ topic i wrote about what theo had started doing, which was a nicer approach from the ground up. text, color, value and objects are in different classes.

The code is still up here, but is just the beginning

I’m not sure I want to start a third ofw gui addon, as this will confuse things for new users.

todd, how do you feel about integrating some of theos ideas into yours?

I think this is great! And, is the first time that I’ve had a really compelling reason to get the Poco version of OF up and running. Nice work!

Re: combining Theos project w/this one I’d say “yes please”. OF needs a nice simple gui api and between what I’ve seen in the simpleGui and this, I think it’s getting close. I especially like the simple:

GUI.addSlider(“Radius”, &radius, 0.0, 200.0, 0);


thanks I like to keep it simple. I will totally add theos code into this, I have some idea for a color class and ui. I’ll will post new features soon.

So I made some improvements and made it even more simpler. I added a 2d slider and a neat little movie player gui. You no longer need to write xml or pass in a xmlID. just type one line of code and thats it.


ofxSimpleGui GUI;		<-- super simple gui  
// -- name (string)  
// -- variable (float or int)  
// -- min (float or int)  
// -- max (float or int)  
GUI.addSlider("name", &float_int, min, max);	<-- add a slider  
// -- name (string)  
// -- variable (ofxVec2f)  
// -- minx (float)  
// -- maxx (float)  
// -- miny (float)  
// -- maxy (float)	  
GUI.addSlider2d("name", &ofxVec2f, minX, maxX, minY, maxY);  
// -- name (string)  
// -- variable (bool)		  
GUI.addToggle("name", &bool);  
// -- name (string)  
// -- variable (ofVideoPlayer)  
// -- the movie gui has two feature pause/play and  
// -- a looping click (1) for cue point one and (2)   
// -- for cue point two. (r) will reset the cue.  
// -- this is nice for analyzing a part of video for opencv  
GUI.addMovieSlider("name", &video);  
GUI.setTitle("GUI Title");	<-- set the title of the gui  
GUI.setAutoSave(true)		<-- enable auto saving  
GUI.setFromXML("xmlfile.xml");  <-- set from xml  
GUI.saveToXML("xmlfile.xml");   <-- save to xml  
GUI.setVerbose(bool);		<-- talk to me  

Great work vanderlin!

Looks like i’ll have to port over my project that’s using ofxGUI to this.

If you get extra time, you might want to look at the ofxGUI thread to see the feature requests some of us had.

One thing I’ve been missing is a text box used for input (typing into a box) or maybe/also some dropdown menu (might be tougher).

Nonetheless, great work and I look forward to trying it.

Wow looks really great. Again though:

Could you post the links to where to get the other addons like poco or ofxTodd you mentioned? Or is there like a general page where I can get them from that I missed?

Thank you!

Edit: okay sorry I found todd, I thought you replaced the second link with the first one. Now I just have to get poco to run.

EDIT2: I get a huge load of errors most of them like:

/Users/matthiasdorfelt/Desktop/openFrameworks/of_preRelease_v0.05_xcode_FAT/apps/addonsExamples/ribbons_high_resolution/…/…/…/addons/ofxSimpleGui/src/ofxToggle.h:39: error: ‘ofMouseEvents’ was not declared in this scope
/Users/matthiasdorfelt/Desktop/openFrameworks/of_preRelease_v0.05_xcode_FAT/apps/addonsExamples/ribbons_high_resolution/…/…/…/addons/ofxSimpleGui/src/ofxToggle.h:40: error: ‘ofKeyEvents’ was not declared in this scope

are those caused because I maybe installed poco the wrong way? what version are you referencing to?

hey - sorry it is our fault as we gave todd a partially finished of folder structure.

here is the latest OF (close to 006) hooked up with poco and todd’s simplegui
and a couple of nice coordinate / quad warping examples from the workshop we are doing in japan. oh and it has firmatta hooked up from eric’s latest release.


also just with standard and addon examples (but latest code)

great thanks theo! I am exited to check that out. I hope it takes my old code though :wink:

I got it to work now. Is it possible to decide myself when I draw the GUI? I am working with alot of different openGL matrices (camera) and shaders so that the gui right now appears in pretty bad places.

ahh yes,
I wanted to make it so you dont have to worry about drawing object at all. This is a bit limiting maybe i can think of a optional way to render.

I change the call for draw() to render() so no all you do is just call GUI.render() in your draw function.


yeah, thats what I did now. As far as I can tell it works.

Vanderlin I once again want to tell you that you did an incredible job! It’s really easy to use. Some things I would like to see implemented in the future are:

Lists of RadioButtons (e.g: for mode changes)
Simple Buttons (I think you allready started a class but it looks like a copy of the Toggle class if I am not wrong)

Maybe Color sliders

and it would be awesome if you would have a function to arange you GUI elements on the screen, maybe in groups. If those groups would have a certain size and scrollbars (like an extra frame) it would be even better. but that’s just me go crazy :wink:


Remember its called ofxSimpleGui! Simple is good. If you need more complex stuff like colors, gui arrange, groups, panels etc… ofxGui already has those features.

my2cents :slight_smile:

My question would be if the ofxTodd stuff will be incorporated into oF. I find those utilities to be very helpful and it seem like they could be incorporated into oF really easily. Or at least maybe name it something more descriptive(no offense Todd) like ofxAdvUtils that could be its own addon. These can definitely be expanded upon as a separate thing.

I could be wrong, but ding, I was thinking the “simple gui” meant more like “simple to use.” The ofxGUI does have more options, but it doesn’t use poco and is really the opposite of simple to setup (no offense to stiwi hehe). I don’t think groups, panels, arrange, would make it less simple as long as the code to call the functions are simple and straightforward like the current ones.

I agree with cerupcat. Anyways I think the one’s working on it will have to decide and thats todd vanderlin right now :slight_smile:

makes sense and I get what you guys are saying. My point is that the more features you add the more complex this gets which defeats the purpose of simple. It’s always a balancing act. BTW ofxGui has already been converted into poco. check it out here.…-CO-GUI.zip

this is indeed a really simple to use gui… nice work Todd! I’ve started using it and its working brilliantly (I was using Quartz Composer + OSC to control variables up to now, works quite well, but this is simpler :stuck_out_tongue:

P.S. the ofxTodd stuff is awesome too, i’d nominate they get included in the core too (especially the lerp, map, norm, constrain etc. - i know it may look like its ripping Processing, but these have been standard math utils in every iibrary for way longer than processing :stuck_out_tongue: - in fact I’d recommend step and smoothstep as well)

i agree I will post it and see if zack and theo will add it to ofUtils. I have some new stuff im adding to gui. collapsible panels and returns of all the gui elements, so if you want you can render your own arrangment. :stuck_out_tongue: