快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

cocos2d-xCCScheduler-创新互联

CCNode::CCNode(void){

创新互联建站是一家企业级云计算解决方案提供商,超15年IDC数据中心运营经验。主营GPU显卡服务器,站群服务器,成都机柜租用,海外高防服务器,大带宽服务器,动态拨号VPS,海外云手机,海外云服务器,海外服务器租用托管等。

  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();

  }

}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页名称:cocos2d-xCCScheduler-创新互联
网页路径:http://6mz.cn/article/dpihcj.html

其他资讯