当前位置: 首页>>代码示例>>C++>>正文


C++ CCTimer类代码示例

本文整理汇总了C++中CCTimer的典型用法代码示例。如果您正苦于以下问题:C++ CCTimer类的具体用法?C++ CCTimer怎么用?C++ CCTimer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCTimer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CCTimer

CCTimer* CCTimer::timerWithTarget(CCObject *pTarget, SEL_SCHEDULE pfnSelector, ccTime fSeconds)
{
	CCTimer *pTimer = new CCTimer();

	pTimer->initWithTarget(pTarget, pfnSelector, fSeconds);
	pTimer->autorelease();

	return pTimer;
}
开发者ID:136446529,项目名称:Tiny-Wings-Remake-on-Android,代码行数:9,代码来源:CCScheduler.cpp

示例2: CCTimer

CCTimer* CCTimer::timerWithScriptFuncName(const char* pszFuncName, ccTime fSeconds)
{
	CCTimer *pTimer = new CCTimer();

	pTimer->initWithScriptFuncName(pszFuncName, fSeconds);
	pTimer->autorelease();

	return pTimer;
}
开发者ID:fordream,项目名称:MyFanCard01,代码行数:9,代码来源:CCScheduler.cpp

示例3: CCAssert

void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused)
{
	CCAssert(pfnSelector, "");
	CCAssert(pTarget, "");

	tHashSelectorEntry *pElement = NULL;
	HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement);

	if (! pElement)
	{
		pElement = (tHashSelectorEntry *)calloc(sizeof(*pElement), 1);
		pElement->target = pTarget;
		if (pTarget)
		{
		    pTarget->retain();
		}
		HASH_ADD_INT(m_pHashForSelectors, 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 (unsigned int i = 0; i < pElement->timers->num; ++i)
		{
			CCTimer *timer = (CCTimer*)pElement->timers->arr[i];

			if (pfnSelector == timer->m_pfnSelector)
			{
				CCLOG("CCSheduler#scheduleSelector. Selector already scheduled.");
				timer->m_fInterval = fInterval;
				return;
			}		
		}
		ccArrayEnsureExtraCapacity(pElement->timers, 1);
	}

	CCTimer *pTimer = new CCTimer();
	pTimer->initWithTarget(pTarget, pfnSelector, fInterval);
	ccArrayAppendObject(pElement->timers, pTimer);
	pTimer->release();	
}
开发者ID:136446529,项目名称:Tiny-Wings-Remake-on-Android,代码行数:51,代码来源:CCScheduler.cpp


注:本文中的CCTimer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。