Copy constructor

Copy constructor
0.0 0



Can you add in Sprites,Nodes,Layer the copy constructor and = operator;

Also If it is possible in CCTexture2d I saw the function
bool initWithData(const void* data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, CCSize contentSize);

can you please make void* data a CCTexture 2d class member and add a getter for it.


hello, in CCTexture2d, when we call initWithData(const void* data, …), the image data will be send to the vedio memory imediately, and the “data” in the local memory may be deleted, so the “void *data” shouldn’t be make a member of CCTexture2D.

about copy constructer, walzer or ming will reply you soon.


Thank you,

How can I access then the raw data from CCTexture2d for the texture in an effective way.It would be very useful for collision detection for example. Auto-trace the bitmap contour and generate the polygon for collision for a particular sprite.

Regarding the copy constructors they could not to copy the childrens or the parent they could copy only the internal properties such as textures,position etc.
Also would be nice for animations ,action classes to implement the copy constructor.

Another question : It is possible to change the texture of a sprite after it was created ?


We don’t record the data, or it would cosume very much memory. So you can not access the raw data. I think you can use box2d to do the collision detection, or you should change the engine code to satisfy with it.


Yes, you can change the texture of a sprite after it was created by CCTextrue::setTexture() and CCTexture::setTextureRect().