CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone) { vector<CCPoint*> *newArray = new vector<CCPoint*>(); vector<CCPoint*>::iterator iter; for (iter = m_pPoints->begin(); iter != m_pPoints->end(); ++iter) { newArray->push_back(new CCPoint((*iter)->x, (*iter)->y)); } CCPointArray *points = new CCPointArray(); points->initWithCapacity(10); points->setPoints(newArray); return points; }
CCPointArray* CCPointArray::create(unsigned int capacity) { CCPointArray* ret = new CCPointArray(); if (ret) { if (ret->initWithCapacity(capacity)) { ret->autorelease(); } else { delete ret; ret = NULL; } } return ret; }
CCPointArray* CCPointArray::create(unsigned int capacity) { CCPointArray* ret = new CCPointArray(); if (ret) { if (ret->initWithCapacity(capacity)) { CC_SAFE_AUTORELEASE(ret); } else { delete ret; ret = NULL; } } return ret; }
NS_CC_BEGIN /* * Implementation of CCPointArray */ CCPointArray* CCPointArray::create(unsigned int capacity) { CCPointArray* ret = new CCPointArray(); if (ret) { if (ret->initWithCapacity(capacity)) { ret->autorelease(); } else { delete ret; ret = NULL; } } return ret; }