您好,登錄后才能下訂單哦!
voidBattleView::ccTouchesBegan(CCSet *pTouches,CCEvent *pEvent)
{
//CCSet的迭代器
CCSetIterator iter = pTouches->begin();
//迭代出pTouches所有Touches
for (;iter!= pTouches->end();iter++)
{
//取出Touches
CCTouch* pTouch = (CCTouch*)(*iter);
//得到取出的Touch的位置坐標
CCPoint location = pTouch->getLocation();
//保存第一個點坐標
if (pTouch->getID()==0)
{
m_Point1 = location;
initialD = true;
}
//第二個點,保存坐標
if (pTouch->getID()==1&& initialD ==true)
{
m_Point2 = location;
m_beganLocation = location;
}
}
}
voidBattleView::ccTouchesMoved(CCSet *pTouches,CCEvent *pEvent)
{
CCSetIterator iter = pTouches->begin();
for (;iter!=pTouches->end();iter++)
{
CCTouch* pTouch = (CCTouch*)(*iter);
//得到觸摸點的坐標
CCPoint location = pTouch->getLocation();
if (pTouch->getID()==0)
{
movePoint1 = location;
}
if (pTouch->getID()==1)
{
movePoint2 = location;
m_endLocation = location;
CCPoint moveTo=ccpSub(m_endLocation, m_beganLocation);
m_beganLocation=m_endLocation;
m_BattleWorld->setPosition(ccpAdd(m_BattleWorld->getPosition(), moveTo));
}
}
這里解決了屏幕閃的問題,想想為什么呢?
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。