bool CCParallaxScrollNode::init() { bool ret = true; if (ret) { scrollOffsets = ccArrayNew(5); } return ret; }
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); } }
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); } }
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(); }
ParallaxNode::ParallaxNode() { _parallaxArray = ccArrayNew(5); _lastPosition.set(-100.0f, -100.0f); }
ParallaxNode::ParallaxNode() { _parallaxArray = ccArrayNew(5); _lastPosition = Vec2(-100,-100); }
bool CCArray::initWithCapacity(unsigned int capacity) { data = ccArrayNew(capacity); return true; }
ParallaxContainer::ParallaxContainer() { _parallaxArray = ccArrayNew(5); _lastPosition = Vec2(-100,-100); }