Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
Created January 16, 2024 01:00
Show Gist options
  • Save moebiussurfing/b2a5264b252fa0bcbe03f1a2ccb7ea56 to your computer and use it in GitHub Desktop.
Save moebiussurfing/b2a5264b252fa0bcbe03f1a2ccb7ea56 to your computer and use it in GitHub Desktop.
ofParameterGroup callback lambda new api
ofParameterGroup parameters;
ofEventListener listenerParameters;
parameters.add(param1.set("p1", 1.f, 0.f, 10.f));
parameters.add(param2.set("p2", 10.f, 1.f, 50.f));
parameters.add(param3.set("p3", 5, 0, 10));
listenerParameters = parameters.parameterChangedE().newListener([this](ofAbstractParameter& e){
string n = e.getName();
ofLogNotice("ofApp") << "Changed " << n << ": " << e;
if(e.isOfType<float>()) {
if(n == param1.getName() ){
ofParameter<float>& paramfloat = e.cast<float>();
// if(paramfloat.get()!=paramfloat.getInit()) {
//param has changed
//...
// }
}
else if(n == param2.getName() ){
//ofParameter<float>& paramfloat = e.cast<float>();
//...
}
else if(n == param3.getName() ){
//ofParameter<float>& paramfloat = e.cast<float>();
//...
}
}
else if(e.isOfType<int>()) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment