如何在cocos2dx中用多点触摸实现cocostudio地图的缩放
1个回答
推荐于2016-01-21
展开全部
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);
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);
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询