中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

cocos2d-x CCScheduler

發布時間:2020-05-30 05:21:11 來源:網絡 閱讀:1332 作者:cgw0827 欄目:游戲開發


CCNode::CCNode(void){

   m_pScheduler = director->getScheduler();

   m_pScheduler->retain();

}


void CCNode::schedule(SEL_SCHEDULE selector)

{

this->schedule(selector, 0.0f, kCCRepeatForever, 0.0f);

}


void CCNode::schedule(SEL_SCHEDULE selector, float interval, unsignedint repeat, float delay)

{

CCAssert( selector, "Argument must be non-nil");

CCAssert( interval >=0, "Argument must be positive");


m_pScheduler->scheduleSelector(selector, this, interval , repeat, delay, !m_bRunning);

}


void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, unsignedint repeat, float delay, bool bPaused)

{

CCAssert(pfnSelector, "Argument selector must be non-NULL");

CCAssert(pTarget, "Argument target must be non-NULL");


tHashTimerEntry *pElement = NULL;

HASH_FIND_INT(m_pHashForTimers, &pTarget, pElement);


if (! pElement)

   {

       pElement = (tHashTimerEntry *)calloc(sizeof(*pElement), 1);

       pElement->target = pTarget;

if (pTarget)

       {

           pTarget->retain();

       }

HASH_ADD_INT(m_pHashForTimers, target, pElement);


// Is this the 1st element ? Then set the pause level to all the selectors of this target

       pElement->paused = bPaused;

   }

else

   {

CCAssert(pElement->paused == bPaused, "");

   }


if (pElement->timers == NULL)

   {

       pElement->timers = ccArrayNew(10);

   }

else

   {

for (unsignedint i = 0; i < pElement->timers->num; ++i)

       {

CCTimer *timer = (CCTimer*)pElement->timers->arr[i];


if (pfnSelector == timer->getSelector())

           {

CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), fInterval);

               timer->setInterval(fInterval);

return;

           }        

       }

ccArrayEnsureExtraCapacity(pElement->timers, 1);

   }


CCTimer *pTimer = newCCTimer();

   pTimer->initWithTarget(pTarget, pfnSelector, fInterval, repeat, delay);

ccArrayAppendObject(pElement->timers, pTimer);

   pTimer->release();    

}






bool CCDirector::init(void)

{

   

// scheduler

m_pScheduler = newCCScheduler();

// action manager

m_pActionManager = newCCActionManager();

m_pScheduler->scheduleUpdateForTarget(m_pActionManager, kCCPrioritySystem, false);

}


// Draw the Scene

voidCCDirector::drawScene(void)

{


//tick before glClear: issue #533

if (! m_bPaused)

   {

m_pScheduler->update(m_fDeltaTime);

   }

}


void CCDisplayLinkDirector::mainLoop(void)

{

if (m_bPurgeDirecotorInNextLoop)

   {

m_bPurgeDirecotorInNextLoop = false;

purgeDirector();

   }

elseif (! m_bInvalid)

    {

drawScene();


// release the objects

CCPoolManager::sharedPoolManager()->pop();        

    }

}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

临海市| 甘洛县| 黔江区| 盐山县| 玉环县| 南开区| 北京市| 彭州市| 克山县| 佛山市| 延吉市| 巴彦县| 蕉岭县| 承德县| 阜南县| 东源县| 肇庆市| 南郑县| 天镇县| 定襄县| 榆社县| 南城县| 千阳县| 囊谦县| 新乡县| 寻乌县| 济南市| 府谷县| 呼伦贝尔市| 靖远县| 离岛区| 英吉沙县| 海林市| 温泉县| 河间市| 大冶市| 筠连县| 济南市| 清水县| 晴隆县| 玛多县|