本文整理汇总了C++中CCTouchHandler::getDelegate方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTouchHandler::getDelegate方法的具体用法?C++ CCTouchHandler::getDelegate怎么用?C++ CCTouchHandler::getDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCTouchHandler
的用法示例。
在下文中一共展示了CCTouchHandler::getDelegate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forceAddHandler
//
// handlers management
//
void CCTouchDispatcher::forceAddHandler(CCTouchHandler *pHandler, CCArray *pArray)
{
unsigned int u = 0;
CCObject* pObj = NULL;
CCARRAY_FOREACH(pArray, pObj)
{
CCTouchHandler *h = (CCTouchHandler *)pObj;
if (h)
{
if (h->getPriority() < pHandler->getPriority())
{
++u;
}
if (h->getDelegate() == pHandler->getDelegate())
{
CCAssert(0, "");
return;
}
}
}
示例2: touches
//
// dispatch events
//
void CCTouchDispatcher::touches(CCSet *pTouches, CCEvent *pEvent, unsigned int uIndex)
{
assert(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)
{
#ifdef ENABLE_LUA
CCString*pLuaFn = pHandler->getDelegate()->getLuaEvent(ccTouchBegan);
if (pLuaFn)
{
bClaimed = true;
pHandler->getDelegate()->excuteLuaTouchEvent(pLuaFn, pTouch);
}
else
{
bClaimed = pHandler->getDelegate()->ccTouchBegan(pTouch, pEvent);
}
#else
bClaimed = pHandler->getDelegate()->ccTouchBegan(pTouch, pEvent);
#endif
if (bClaimed)
{
pHandler->getClaimedTouches()->addObject(pTouch);
}
} else
if (pHandler->getClaimedTouches()->containsObject(pTouch))
{
// moved ended cancelled
bClaimed = true;
#ifdef ENABLE_LUA
CCString*pLuaFn = pHandler->getDelegate()->getLuaEvent(sHelper.m_type);
switch (sHelper.m_type)
{
case ccTouchMoved:
if (pLuaFn)
{
pHandler->getDelegate()->excuteLuaTouchEvent(pLuaFn, pTouch);
}
else
{
pHandler->getDelegate()->ccTouchMoved(pTouch, pEvent);
}
break;
case ccTouchEnded:
if (pLuaFn)
{
pHandler->getDelegate()->excuteLuaTouchEvent(pLuaFn, pTouch);
}
else
{
pHandler->getDelegate()->ccTouchEnded(pTouch, pEvent);
}
pHandler->getClaimedTouches()->removeObject(pTouch);
break;
case ccTouchCancelled:
if (pLuaFn)
{
pHandler->getDelegate()->excuteLuaTouchEvent(pLuaFn, pTouch);
}
else
{
pHandler->getDelegate()->ccTouchCancelled(pTouch, pEvent);
//.........这里部分代码省略.........