标签:ati touch moved one eve 结束 with priority location
auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event){ Point pos = touch->getLocation(); Point pos1 = touch->getLocation(); /* 获取单击坐标,基于3D */ Point pos2 = touch->getLocationInView(); /* 获取单击坐标,基于2D */ Point pos3 = Director::getInstance()->convertToGL(pos2); /* 获取单击坐标,基于Cocos2d-x */ log("HelloWorldScene onTouchBegan! pos1 x=%f, y=%f", pos1.x, pos1.y); log("HelloWorldScene onTouchBegan! pos2 x=%f, y=%f", pos2.x, pos2.y); log("HelloWorldScene onTouchBegan! pos3 x=%f, y=%f", pos3.x, pos3.y); return true; }; listener->onTouchMoved = [](Touch* touch, Event* event){ log("HelloWorldScene onTouchMoved"); }; listener->onTouchEnded = [=](Touch* touch, Event* event){ log("HelloWorldScene onTouchEnded"); }; _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
1、OnTouchBegan():触摸开始,就是触碰的一瞬间会调用这个函数。
2、OnTouchMoved():在触摸中,触摸不放开移动会调用这个函数。
3、OnTouchEnded():触摸结束,就是触摸结束的一瞬间会调用这个函数。
标签:ati touch moved one eve 结束 with priority location
原文地址:http://www.cnblogs.com/xiaohaige/p/7691268.html