Skip to content

Instantly share code, notes, and snippets.

@trentbrooks
Created November 13, 2013 06:33
Show Gist options
  • Save trentbrooks/7444679 to your computer and use it in GitHub Desktop.
Save trentbrooks/7444679 to your computer and use it in GitHub Desktop.
Easy event listener adding/removing. Put below methods in the object's .h only, and make sure the testApp has the onSomething method.
template <class ListenerClass>
void addEventListener(ListenerClass * listener){
ofAddListener(onChangedEvent,listener,&ListenerClass::onSomething);
};
template <class ListenerClass>
void removeEventListener(ListenerClass * listener){
ofRemoveListener(onChangedEvent,listener,&ListenerClass::onSomething);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment