axmol/tools/tolua++/selector_protocol.pkg

58 lines
2.2 KiB
Plaintext

namespace cocos2d {
class CCNode;
class CCEvent;
class CCScriptSelector
{
std::string m_scriptFunc[ccSEL_Max];
//szType ={"SEL_Update", "SEL_Tick", "SEL_CallFunc", "SEL_CallFuncN", \
// "SEL_CallFuncND", "SEL_CallFuncO", "SEL_MenuHandler", "SEL_EventHandler"};
bool registerScriptSelector(const char* szType, const char* szSeletor);
};
class SelectorProtocol:public CCScriptSelector
{
public:
SelectorProtocol();
void update(ccTime dt);
void tick(ccTime dt);
void callfunc();
void callfunc(CCNode* pSender);
void callfunc(CCNode* pSender, void* pData);
void menuHandler(CCObject* pSender);
void eventHandler(CCEvent* pEvent);
// the child call responding retain/release function
void selectorProtocolRetain(void);
void selectorProtocolRelease(void);
};
/*
class CCNode;
typedef void (SelectorProtocol::*SEL_SCHEDULE)(ccTime);
typedef void (SelectorProtocol::*SEL_CallFunc)();
typedef void (SelectorProtocol::*SEL_CallFuncN)(CCNode*);
typedef void (SelectorProtocol::*SEL_CallFuncND)(CCNode*, void*);
typedef void (SelectorProtocol::*SEL_CallFuncO)(CCObject*);
typedef void (SelectorProtocol::*SEL_MenuHandler)(CCObject*);
typedef void (SelectorProtocol::*SEL_EventHandler)(CCEvent*);
// #define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(*((SEL_SCHEDULE*)(&(&_SELECTOR))) )
// #define callfunc_selector(_SELECTOR) (SEL_CallFunc)(*((SEL_CallFunc*)(&(&_SELECTOR))) )
// #define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(*((SEL_CallFuncN*)(&(&_SELECTOR))) )
// #define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(*((SEL_CallFuncND*)(&(&_SELECTOR))) )
// #define menu_selector(_SELECTOR) (SEL_MenuHandler)(*((SEL_MenuHandler*)(&(&_SELECTOR)))
#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(&_SELECTOR)
#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR)
#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR)
#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR)
#define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR)
#define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR)
#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR)
*/
}//namespace cocos2d