コード例 #1
0
 bool CCParallaxScrollNode::init()
 {
     bool ret = true;
     
     if (ret)
     {
         scrollOffsets = ccArrayNew(5);
     }
     
     return ret;
 }
コード例 #2
0
void CCActionManager::actionAllocWithHashElement(tHashElement *pElement)
{
    // 4 actions per Node by default
    if (pElement->actions == NULL)
    {
        pElement->actions = ccArrayNew(4);
    } else if (pElement->actions->num == pElement->actions->max)
    {
        ccArrayDoubleCapacity(pElement->actions);
    }

}
コード例 #3
0
void ActionManager::actionAllocWithHashElement(tHashElement *element)
{
    // 4 actions per Node by default
    if (element->actions == nullptr)
    {
        element->actions = ccArrayNew(4);
    }else 
    if (element->actions->num == element->actions->max)
    {
        ccArrayDoubleCapacity(element->actions);
    }

}
コード例 #4
0
void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *pTarget, float fInterval, bool bPaused)
{
	assert(pfnSelector);
	assert(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->selectorProtocolRetain();
		}
		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
	{
		assert(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();	
}
コード例 #5
0
ParallaxNode::ParallaxNode()
{
    _parallaxArray = ccArrayNew(5);        
    _lastPosition.set(-100.0f, -100.0f);
}
コード例 #6
0
ParallaxNode::ParallaxNode()
{
    _parallaxArray = ccArrayNew(5);        
    _lastPosition = Vec2(-100,-100);
}
コード例 #7
0
ファイル: CCArray.cpp プロジェクト: fordream/MyFanCard01
bool CCArray::initWithCapacity(unsigned int capacity)
{
    data = ccArrayNew(capacity);
    return true;
}
コード例 #8
0
ファイル: ParallaxContainer.cpp プロジェクト: Ratel13/avalon
ParallaxContainer::ParallaxContainer()
{
    _parallaxArray = ccArrayNew(5);
    _lastPosition = Vec2(-100,-100);
}