标签:style blog io os 使用 sp div on 2014
//创建create方法,自动调用init和返回主类 virtual bool init(); CREATE_FUNC(); //自定义create方法 //static xxx* create(xxx);
//点击事件监听(开始按下的时候)
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [](Touch *t,Event *e)
{
//return true会使得后面的其它监听也执行
return true;
};
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener,this);
//碰撞监听,监听的物体必须设置getPhysicsBody()->setContactTestBitmask(1);
auto contactListener = EventListenerPhysicsContact::create();
contactListener->onContactBegin = [](PhysicsContact &contact)
{
return true;
};
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(contactListener,this);
【cocos2dx 3.2】使用搜狗输入法短词,复用常用的代码段
标签:style blog io os 使用 sp div on 2014
原文地址:http://blog.csdn.net/ns2250225/article/details/40451887