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就可以使用自动管理内存了。然后我们来看下它的一些函数: 总结
以上是内存溢出为你收集整理的cocos2dx 源码学习5 CCPointArray全部内容,希望文章能够帮你解决cocos2dx 源码学习5 CCPointArray所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)