欢迎转载:http://blog.csdn.net/fylz1125/article/details/8546607
cocos2d-x中有大量的回调函数的应用,主要有以下几类,看下CCObject.h中的定义
- typedefvoid(CCObject::*SEL_SCHEDULE)(float);//用来调update
- typedefvoid(CCObject::*SEL_CallFunc)();//用来自定义无参回调
- typedefvoid(CCObject::*SEL_CallFuncN)(CCNode*);//带执行者回调
- typedefvoid(CCObject::*SEL_CallFuncND)(CCNode*,void*);//带一个自定参数的回调
- typedefvoid(CCObject::*SEL_CallFuncO)(CCObject*);
- typedefvoid(CCObject::*SEL_MenuHandler)(CCObject*);
- typedefvoid(CCObject::*SEL_EventHandler)(CCEvent*);
- typedefint(CCObject::*SEL_Compare)(CCObject*);
- #defineschedule_selector(_SELECTOR)(SEL_SCHEDULE)(&_SELECTOR)
- #definecallfunc_selector(_SELECTOR)(SEL_CallFunc)(&_SELECTOR)
- #definecallfuncN_selector(_SELECTOR)(SEL_CallFuncN)(&_SELECTOR)
- #definecallfuncND_selector(_SELECTOR)(SEL_CallFuncND)(&_SELECTOR)
- #definecallfuncO_selector(_SELECTOR)(SEL_CallFuncO)(&_SELECTOR)
- #definemenu_selector(_SELECTOR)(SEL_MenuHandler)(&_SELECTOR)
- #defineevent_selector(_SELECTOR)(SEL_EventHandler)(&_SELECTOR)
- #definecompare_selector(_SELECTOR)(SEL_Compare)(&_SELECTOR)