bool CCParallaxScrollNode::init()
 {
     bool ret = true;
     
     if (ret)
     {
         scrollOffsets = ccArrayNew(5);
     }
     
     return ret;
 }
Exemplo n.º 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);
    }

}
Exemplo n.º 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);
    }

}
Exemplo n.º 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();	
}
Exemplo n.º 5
0
ParallaxNode::ParallaxNode()
{
    _parallaxArray = ccArrayNew(5);        
    _lastPosition.set(-100.0f, -100.0f);
}
Exemplo n.º 6
0
ParallaxNode::ParallaxNode()
{
    _parallaxArray = ccArrayNew(5);        
    _lastPosition = Vec2(-100,-100);
}
Exemplo n.º 7
0
bool CCArray::initWithCapacity(unsigned int capacity)
{
    data = ccArrayNew(capacity);
    return true;
}
Exemplo n.º 8
0
ParallaxContainer::ParallaxContainer()
{
    _parallaxArray = ccArrayNew(5);
    _lastPosition = Vec2(-100,-100);
}