Thanks to visit codestin.com
Credit goes to blog.openframeworks.cc

ofxGui new features

The first post in the series about the new features in the 0.10.0 release, is going to be a short one about the gui.

Color picker

Up until 0.9.8 editing colors in the gui could only be done by adjusting the different rgb values using individual sliders which was not very intuitive:

In 0.10.0 it looks like this:

The new color picker is based on ofxColorPicker by Lukasz Karluk adapted to work with ofxGui and ofParameter

Text fields

In 0.10.0 ofxGui will add a text field for any ofParameter or you can create it manually using ofxInputField.

This new control is based on the original ofxInputField by Felix Lange with additions to better support selection, utf8 and clipboard.

Additionally any slider can be turned into an input field temporarily by right clicking on it, allowing for much more precise input.

Apart from this, one can now add an ofParameter<void> in a parameter group to get a button, add listeners to the save and load buttons to override the default save and load behavior:

panel.savePressedE.addListener([this]{
    // custom save

    return true; // to mark the event as attended 
                 // so the gui doesn't do the default save
});

panel.loadPressedE.addListener([this]{
    // custom load

    return true; // to mark the event as attended 
                 // so the gui doesn't do the default load
});

Also specifying a “.json” file when creating a panel instead of an “.xml” will load and save from json.

Arturo