ios - ""CCSprite is not using the same texture id"" workaround? -
i animating whole body through spritesheets ccspritebatchnode , ccspriteframecache. user can add own pic body when try addchild spritesheet crashes error "ccsprite not using same texture id"
now know face ccsprite not in cache/texture(it created through texturepacker) , crash normal wanted know if there workaround have add face body through user interaction , animate body. , far using spritesheets best option animation. anyone??
in case can take picture of user , make texture user's image . add texture cctexturecache . have texture of user image. can use texture in animation.
make texture sprite(you can make sprite user image)
ccsprite *spr = nil;//your sprite ccrendertexture* rendertexture = [ccrendertexture rendertexturewithwidth:spr.contentsize.width height:spr.contentsize.height]; spr.anchorpoint = ccp(0, 0); spr.position = ccp(0, 0); [rendertexture addchild:spr]; [rendertexture begin]; [spr draw]; // or [spr visit]; [rendertexture end]; cctexture2d *result = rendertexture.sprite.texture;
add texture in texture cache.
[[cctexturecache sharedtexturecache] addtexture]
Comments
Post a Comment