CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone)
{
    CCArray *newArray = (CCArray*)m_pControlPoints->copy();
    CCPointArray *points = CCPointArray::create(10);
    points->retain();
    points->setControlPoints(newArray);
    newArray->release();
    
    return points;
}
CCPointArray* CCPointArray::reverse()
{
    CCArray *newArray = new CCArray(m_pControlPoints->count());
    for (int i = m_pControlPoints->count()-1; i >= 0; --i)
    {
        newArray->addObject(m_pControlPoints->objectAtIndex(i));
    }
    CCPointArray *config = CCPointArray::create(0);
    config->setControlPoints(newArray);
    
    newArray->release();
    
    return config;
}
Example #3
0
CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone)
{
    vector<CCPoint*> *newArray = new vector<CCPoint*>();
    vector<CCPoint*>::iterator iter;
    for (iter = m_pControlPoints->begin(); iter != m_pControlPoints->end(); ++iter)
    {
        newArray->push_back(new CCPoint((*iter)->x, (*iter)->y));
    }
    
    CCPointArray *points = new CCPointArray();
    points->initWithCapacity(10);
    points->setControlPoints(newArray);
    
    return points;
}
Example #4
0
CCPointArray* CCPointArray::reverse()
{
    vector<CCPoint*> *newArray = new vector<CCPoint*>();
    vector<CCPoint*>::reverse_iterator iter;
    CCPoint *point = NULL;
    for (iter = m_pControlPoints->rbegin(); iter != m_pControlPoints->rend(); ++iter)
    {
        point = *iter;
        newArray->push_back(new CCPoint(point->x, point->y));
    }
    CCPointArray *config = CCPointArray::create(0);
    config->setControlPoints(newArray);
    
    return config;
}