@vollstock wrote:
In my app I would like to be able to linke values of arbitrary parameters.
For this I plan to change all of my member variables toofParameter
.I understand, that I can add listener methods to them. Like this
myObject.h
[…] ofParameter<unsigned char> myParameter; unsigned char getMyParameter(); void setMyParameter(unsigned char value); void setMyParameterFromListener(unsigned char & value); […]
and then add the function as a listener
test1 = new myObject(); test2 = new myObject(); test1->myParameter.addListener(test2, &myObject::setMyParameterFromListener); test1->setValue(128); ofLogNotice() << "test1: " << (int)test1->getValue(); ofLogNotice() << "test2: " << (int)test2->getValue(); // [notice ] test1: 128 // [notice ] test2: 128
This way, however I would need to add a method for each and every parameter in each and every class I write
Is there a direct way to link the value of two ofParameters (of the same type)?
Something like this would be perfect:
test1->myParameter.addListener(test3->myParameter, &ofParameter<unsigned char>::set);
Or even better
test1->myParameter.addListener(test3->myParameter)
Posts: 3
Participants: 3