bool MyTouchEvent2::init() { if (!Layer::init()) { return false; } Size visibleSize = Director::getInstance()-getVisibleSize(); Vec2 origin = Director::getInstance()-getVisibleOrigin(); Label * text1 = Label::create(, Arial, 24); text1-setP
bool MyTouchEvent2::init(){
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
Label * text1 = Label::create("", "Arial", 24);
text1->setPosition(Point(400, 280));
this->addChild(text1,1,1);
Label * text2 = Label::create("", "Arial", 24);
text2->setPosition(Point(400, 200));
this->addChild(text2,1,2);
Label * text3 = Label::create("", "Arial", 24);
text3->setPosition(Point(400, 100));
this->addChild(text3,1,3);
//创建多点触摸监听器
auto listener = EventListenerTouchAllAtOnce::create();
//单击
listener->onTouchesBegan = [&](const std::vector
{
auto text = (Label *)this->getChildByTag(1);
int num = touchs.size();
text->setString(Value(num).asString() + "Touches:");
};
多奥淘宝客程序免费版拥有淘宝客站点的基本功能,手动更新少,管理简单等优点,适合刚接触网站的淘客们,或者是兼职做淘客们。同样拥有VIP版的模板引擎技 术、强大的文件缓存机制,但没有VIP版的伪原创跟自定义URL等多项创新的搜索引擎优化技术,除此之外也是一款高效的API数据系统实现无人值守全自动 化运行的淘宝客网站程序。4月3日淘宝联盟重新开放淘宝API申请,新用户也可使用了
// 移动
listener->onTouchesMoved = [&](const std::vector{
auto text = (Label *)this->getChildByTag(2);
int num = touchs.size();
std::string str = Value(num).asString() + "Touches:";
for (auto & touch:touchs)
{
auto location = touch->getLocation();
str += "[touchID" + Value(touch->getID()).asString() + "]";
}
text->setString(str);
};
// 松开
listener->onTouchesEnded = [&](const std::vector{
auto text = (Label*)this->getChildByTag(3);
int num = touchs.size();
text->setString(Value(num).asString()+"Touches:");
};
//注册监听事件
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
return true;
}









