Quantcast
Viewing all articles
Browse latest Browse all 40524

Using ofxGui slider values outside of ofApp

the easiest, and cleanest way to use this is to use ofParameter to represent the speed and then pass that to a panel which will create a slider automatically. take a look at guiFromParametersExample but it would be something like:

class Wave{
public:
void setup(){
    speed.set("wave speed",0,10,100); // value, min, max
}
...
ofParameter<float> speed;
}

in your ofApp:

//.h
ofxPanel gui;
Wave wave;

//setup
wave.setup();
gui.add(wave.speed)

if you are using 0.9.0 you can also initialize parameters in the .h file directly like:

class Wave{
public:
...
ofParameter<float> speed{"wave speed",0,10,100}
}

Viewing all articles
Browse latest Browse all 40524

Trending Articles