Hello,
I'm trying to use ofEvents with c++ templates but I'm having troubles to find the correct syntax. I would really appreciate if someone could help me resolve this.
I'm using pointers for the event as explained in another post and template for the class that is going to register events, so I can use any class with the addListener method...
Here's the code in my class header:
ofEvent<InteractiveArea*> interactiveAreaEvent;
template <class L>
void addListener(L* listener) {
ofAddListener(interactiveAreaEvent, listener, &(L::interactiveAreaEvent));
}
and in my testApp.cpp:
void testApp::interactiveAreaEvent(InteractiveArea* sender){
cout<<"yess"<<endl;
}
void testApp::setup(){
area->addListener(this);
}
I'm getting this error message :
error: no matching function for call to 'ofAddListener(ofEvent<InteractiveArea*>&, nanApp*&, void (nanApp::*)(InteractiveArea*))'|
||=== Build finished: 1 errors, 0 warnings ===|
Thanks in advance for any help! I'm kind of lost here!
Simon.