Example #1
0
void CommonImageCacheManager::pushImage(CAImage* image)
{
    CC_RETURN_IF(m_dImageQueue.contains(image));
    m_dImageQueue.pushBack(image);
    CCArray* array = CCArray::create();
    array->addObject(CCDelayTime::create(10));
    array->addObject(CCCallFunc::create(this, callfunc_selector(CommonImageCacheManager::update)));
    this->runAction(CCSequence::create(array));
}
void CommonImageCacheManager::pushImage(CAImage* image)
{
    CC_RETURN_IF(m_dImageQueue.contains(image));
    m_dImageQueue.pushBack(image);
    
    CAViewAnimation::beginAnimations("", NULL);
    CAViewAnimation::setAnimationDuration(10);
    CAViewAnimation::setAnimationDidStopSelector(this, CAViewAnimation0_selector(CommonImageCacheManager::update));
    CAViewAnimation::commitAnimations();
}
Example #3
0
 void unschedule(SEL_CAAnimation selector, CAObject* target)
 {
     for (CADeque<Animation*>::iterator itr=_deque.begin(); itr!=_deque.end(); itr++)
     {
         Animation* obj = *itr;
         if (obj->m_obInfo.selector == selector && obj->m_obInfo.target == target)
         {
             
             CAScheduler::unscheduleAllForTarget(obj);
             _deque.erase(itr);
             break;
         }
     }
 }
Example #4
0
 bool isSchedule(SEL_CAAnimation selector, CAObject* target)
 {
     bool ret = false;
     
     for (CADeque<Animation*>::iterator itr=_deque.begin(); itr!=_deque.end(); itr++)
     {
         Animation* obj = *itr;
         if (obj->m_obInfo.selector == selector && obj->m_obInfo.target == target)
         {
             ret = true;
             break;
         }
     }
     return ret;
 }
Example #5
0
    void Animation::update(float dt)
    {
        if (m_obInfo.now >= m_obInfo.total)
        {
            _deque.eraseObject(this);
            return;
        }
        
        if (m_obInfo.delay > 0)
        {
            m_obInfo.delay -= dt;
            return;
        }
        
        if (m_obInfo.delay < 0)
        {
            dt += m_obInfo.delay;
            m_obInfo.delay = 0.0f;
        }
        
        m_obInfo.interval = dt;
        m_obInfo.now += dt;
        m_obInfo.now = MIN(m_obInfo.now, m_obInfo.total);

        if (m_obInfo.target && m_obInfo.selector)
        {
            ((CAObject *)m_obInfo.target->*m_obInfo.selector)(m_obInfo.interval, m_obInfo.now, m_obInfo.total);
        }
    }
Example #6
0
 void schedule(SEL_CAAnimation selector, CAObject* target, float totalTime, float interval, float delay)
 {
     CC_RETURN_IF(isSchedule(selector, target));
     Animation* obj = new Animation();
     _deque.pushBack(obj);
     obj->startAnimation(selector, target, totalTime, interval, delay);
     obj->release();
 }
Example #7
0
void CommonImageCacheManager::removeImage(CAImage* image)
{
    m_dImageQueue.eraseObject(image);
}
Example #8
0
void CommonImageCacheManager::update()
{
    CAImageCache::sharedImageCache()->removeImage(m_dImageQueue.front());
    m_dImageQueue.popFront();
}