Hi all !
I’ve simple class structure with a base class and some child classes that extends the base .
I would like to add listeners to OF events to the base and then get the events with the extended child classes.
So I did (tried) :
class ClassA
{
void setup();
void mouseMoved(ofMouseEventArgs &a){};
void mouseDragged(ofMouseEventArgs &a){};
void mousePressed(ofMouseEventArgs &a){};
void mouseReleased(ofMouseEventArgs &a){};
}
ClassA::setup()
{
ofRegisterMouseEvents(this);
}
class ClassB : public ClassA
{
void mouseMoved(ofMouseEventArgs &a);
void mouseDragged(ofMouseEventArgs &a);
void mousePressed(ofMouseEventArgs &a);
void mouseReleased(ofMouseEventArgs &a);
}
Like this, it compiles but events are not reaching it’s function ClassB::mouseMoved() ?¿
Do i need to add the ofRegisterMouseEvents(this); to the child classes ?
I also tried defining on ClassA mouse related functions as ex :
virtual"as ex (virtual void mouseMoved(ofMouseEventArgs&a))
but then i got a crash on execution ?¿
Can someone light me on how to register events on the base class and get the events from the derived classes ?
Thanks !