Created
November 13, 2013 06:33
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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