cocos2d-x之多点触摸事件
cocos2d-x之多点触摸事件
1 //全部所有的触摸点一起触发 2 auto listener = EventListenerTouchAllAtOnce::create(); 3 4 listener->onTouchesBegan = [](std::vector<Touch*> ts, Event *e){ 5 log("onTouchesBegan"); 6 }; 7 8 //获得触摸点的数量 9 listener->onTouchesMoved = [](std::vector<Touch*> ts,Event *e){ 10 log("touches moved,and touch count is %ld", ts.size()); 11 }; 12 13 //this代表,使用的是当前的层作为节点 14 Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);