如何在cocos2dx中用多点触摸实现cocostudio地图的缩放

请教下,如何在cocos2dx中用多点触摸实现cocostudio地图的缩放
最新回答
蓝萱薇

2024-07-08 15:09:24

m_pUIlayer = UILayer::create();
addChild(m_pUIlayer,3);
//加入背景json文件,即背景地图
m_pWidget = static_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("MyGameMap_4/MyGameMap_1.ExportJson"));
m_pUIlayer->addWidget(m_pWidget);
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
CCSize rootSize = m_pWidget->getSize();
m_pUIlayer->setPosition(CCPoint((screenSize.width - rootSize.width) / 2,(screenSize.height - rootSize.height) / 2));

//操作部分
CCSize size = CCDirector::sharedDirector()->getWinSize();
m_pUIlayer->setScale(0.5);
CCActionInterval* actionTo = CCMoveTo::create(1.0f,ccp(size.width,size.height));
m_pUIlayer->runAction(actionTo);