本文整理汇总了C++中CCSet::removeObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSet::removeObject方法的具体用法?C++ CCSet::removeObject怎么用?C++ CCSet::removeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSet
的用法示例。
在下文中一共展示了CCSet::removeObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPointerReleased
void CCEGLView::OnPointerReleased(int id, const CCPoint& point)
{
CCTouch* pTouch = m_pTouches[id];
CCSet* pSet = m_pSets[id];
if (! pTouch || ! pSet)
return;
float x = point.x;
float y = point.y;
ConvertPointerCoords(x, y);
pTouch->SetTouchInfo(x, y);
m_pDelegate->touchesEnded(pSet, NULL);
pSet->removeObject(pTouch);
CC_SAFE_DELETE(m_pTouches[id]);
CC_SAFE_DELETE(m_pSets[id]);
}
示例2: touches
//
// dispatch events
//
void CCTouchDispatcher::touches(CCSet *pTouches, CCEvent *pEvent, unsigned int uIndex)
{
CCAssert(uIndex >= 0 && uIndex < 4, "");
CCSet *pMutableTouches;
m_bLocked = true;
// optimization to prevent a mutable copy when it is not necessary
unsigned int uTargetedHandlersCount = m_pTargetedHandlers->count();
unsigned int uStandardHandlersCount = m_pStandardHandlers->count();
bool bNeedsMutableSet = (uTargetedHandlersCount && uStandardHandlersCount);
pMutableTouches = (bNeedsMutableSet ? pTouches->mutableCopy() : pTouches);
struct ccTouchHandlerHelperData sHelper = m_sHandlerHelperData[uIndex];
//
// process the target handlers 1st
//
if (uTargetedHandlersCount > 0)
{
CCTouch *pTouch;
CCSetIterator setIter;
for (setIter = pTouches->begin(); setIter != pTouches->end(); ++setIter)
{
pTouch = (CCTouch *)(*setIter);
CCTargetedTouchHandler *pHandler;
CCMutableArray<CCTouchHandler*>::CCMutableArrayIterator arrayIter;
for (arrayIter = m_pTargetedHandlers->begin(); arrayIter != m_pTargetedHandlers->end(); ++arrayIter)
/*for (unsigned int i = 0; i < m_pTargetedHandlers->num; ++i)*/
{
pHandler = (CCTargetedTouchHandler *)(*arrayIter);
if (! pHandler)
{
break;
}
bool bClaimed = false;
if (uIndex == CCTOUCHBEGAN)
{
bClaimed = pHandler->getDelegate()->ccTouchBegan(pTouch, pEvent);
if (bClaimed)
{
pHandler->getClaimedTouches()->addObject(pTouch);
}
} else
if (pHandler->getClaimedTouches()->containsObject(pTouch))
{
// moved ended cancelled
bClaimed = true;
switch (sHelper.m_type)
{
case CCTOUCHMOVED:
pHandler->getDelegate()->ccTouchMoved(pTouch, pEvent);
break;
case CCTOUCHENDED:
pHandler->getDelegate()->ccTouchEnded(pTouch, pEvent);
pHandler->getClaimedTouches()->removeObject(pTouch);
break;
case CCTOUCHCANCELLED:
pHandler->getDelegate()->ccTouchCancelled(pTouch, pEvent);
pHandler->getClaimedTouches()->removeObject(pTouch);
break;
}
}
if (bClaimed && pHandler->isSwallowsTouches())
{
if (bNeedsMutableSet)
{
pMutableTouches->removeObject(pTouch);
}
break;
}
}
}
}
//
// process standard handlers 2nd
//
if (uStandardHandlersCount > 0 && pMutableTouches->count() > 0)
{
CCMutableArray<CCTouchHandler*>::CCMutableArrayIterator iter;
CCStandardTouchHandler *pHandler;
for (iter = m_pStandardHandlers->begin(); iter != m_pStandardHandlers->end(); ++iter)
{
pHandler = (CCStandardTouchHandler*)(*iter);
if (! pHandler)
{
break;
}
//.........这里部分代码省略.........