class CC_DLL CCPointArray : public CCObject
{
public:
/** creates and initializes a Points array with capacity
* @lua NA
*/
static CCPointArray* create(unsigned int capacity); 根据参数capacity的大小来创建CCPointArray对象
/**
* @lua NA
*/
virtual ~CCPointArray(); 析构函数
/**
* @lua NA
*/
CCPointArray(); 构造函数
/** initializes a Catmull Rom config with a capacity hint */
bool initWithCapacity(unsigned int capacity); 在调用create函数时会调用此函数
/** appends a control point */
void addControlPoint(CCPoint controlPoint); 添加一个CCPoint到CCPointArray对象
/** inserts a controlPoint at index */
void insertControlPoint(CCPoint &controlPoint,unsigned int index); 插入一个CCPoint到CCPointArray的index位置
/** replaces an existing controlPoint at index */
void replaceControlPoint(CCPoint &controlPoint,unsigned int index); 替换CCPointArray的index位置的数据为CCPoint
/** get the value of a controlPoint at a given index */
CCPoint getControlPointAtIndex(unsigned int index); 返回CCPointArray的index位置的数据CCPoint
/** deletes a control point at a given index */
void removeControlPointAtIndex(unsigned int index); 移除CCPointArray的index位置的CCPoint
/** returns the number of objects of the control point array */
unsigned int count(); CCPointArray中CCPoint的个数 /** returns a new copy of the array reversed. User is responsible for releasing this copy */ CCPointArray* reverse(); /** reverse the current control point array inline,without generating a new one */ void reverseInline(); /** * @js NA * @lua NA */ virtual CCObject* copyWithZone(CCZone *zone); const std::vector<CCPoint*>* getControlPoints(); void setControlPoints(std::vector<CCPoint*> *controlPoints); private: /** Array that contains the control points */ std::vector<CCPoint*> *m_pControlPoints; }; 继承自CCObject,继承CCObject是为了用到内存管理方面的知识,因为CCObject实现了采用了引用计数的方式,这样子类只要继承CCObject就可以使用自动管理内存了。然后我们来看下它的一些函数:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。