Skip to content

Instantly share code, notes, and snippets.

@syuhari
Last active December 12, 2015 03:18
Show Gist options
  • Save syuhari/4705616 to your computer and use it in GitHub Desktop.
Save syuhari/4705616 to your computer and use it in GitHub Desktop.
#include "CCTestLayer.h"
USING_NS_CC;
USING_NS_CC_EXT;
SEL_MenuHandler CCTestLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName)
{
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "menuTapped", CCTestLayer::menuTapped);
return NULL;
}
void CCTestLayer::menuTapped(CCObject *pSender, CCControlEvent pCCControlEvent) {
CCLOG("button tapped");
}
SEL_CCControlHandler CCTestLayer::onResolveCCBCCControlSelector(CCObject *pTarget, CCString*pSelectorName) {
return NULL;
}
#ifndef __TestBuilder__CCTestLayer__
#define __TestBuilder__CCTestLayer__
#include "cocos2d.h"
#include "cocos-ext.h"
class CCTestLayer : public cocos2d::CCLayer, public cocos2d::extension::CCBSelectorResolver
{
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
void menuTapped(CCObject *pSender, cocos2d::extension::CCControlEvent pCCControlEvent);
public:
CREATE_FUNC(CCTestLayer);
};
class TestBuilderLoader : public cocos2d::extension::CCLayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(TestBuilderLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCTestLayer);
};
#endif /* defined(__TestBuilder__CCTestLayer__) */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment