//克隆精灵 CCSprit *clone(CCNode *sp) { CCSprite *csp=NULL; CCSize size=sp->getContentSize(); float tempX=sp->getPositionX(); float tempY=sp->getPositionY(); sp->setPosition(ccp(size.width*0.5,size.height*0.5)); CCRenderTexture *txt=CCRenderTexture::create(size.width,size.height,kCCtexture2DPixelFormat_RGB8888); txt->begin(); sp->visit(); txt->end(); sp->setPosition(ccp(tempX,tempY)); CCImage *img=txt->newCCImage(); CCTexture2D *txt1=new CCTexture2D(); txt1->initWithImage(img); img->release(); txt1->m_name=“SpriteUtils::clone”; csp=CCSprite::createWithTexture(txt1); txt1->release(); return cap; }
//响应底层事件 setSwallowTouches
//2个向量之间的夹角 ccpAngle(a,b)
时间: 2024-10-01 06:56:42