cocos2d-x CCScheduler

发布时间:2020-05-30 05:21:11 作者:cgw0827
阅读:1343
开发者专用服务器限时活动,0元免费领! 查看>>

CCNode::CCNode(void){

   m_pScheduler = director->getScheduler();

}

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)

{

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)

{

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

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

           {

               timer->setInterval(fInterval);

return;

           }        

       }

   }

CCTimer *pTimer = newCCTimer();

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

ccArrayAppendObject(pElement->timers, pTimer);

   pTimer->release();    

}

bool CCDirector::init(void)

{

   

}

// Draw the Scene

voidCCDirector::drawScene(void)

{

if (! m_bPaused)

   {

   }

}

void CCDisplayLinkDirector::mainLoop(void)

{

   {

   }

elseif (! m_bInvalid)

    {

drawScene();

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

    }

}

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:
  1. 18、Cocos2dx 3.0游戏开发找小三之cocos2d-x,请问你是怎么调度的咩
  2. vue组件 $children,$refs,$parent的使用详解

开发者交流群:

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

director schedule positive

上一篇:nagios监控http(借助脚本)

下一篇:线上mysql数据库备份

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
开发者交流群×