Quantcast
Viewing all articles
Browse latest Browse all 40524

How to get the ofParameter from the ofEvent of parameterChangedE()

this is a limitation of c++ where there's no introspection or similar mechanism. the only way to do this is to check explicitly for every type and convert it to that type like:

ofApp::guiEvent(ofAbstractParameter &e){
    if(e.type() == typeid(ofParatemer<int>).name()){
        ofParameter<int> p = e.cast<int>();
        ...
    }else if(e.type() == typeid(ofParameter<float>).name(){
        ofParameter<float> p = e.cast<float>();
        ...
    }else if(e.type() == typeid(ofParameter<ofVec3f>).name(){
        ofParameter<ofVec3f> p = e.cast<ofVec3f>();
        ...
    }
    ...

Viewing all articles
Browse latest Browse all 40524

Trending Articles