• Runtimes
  • Cocos2d-x v3 Skeleton data caching

Hello!

I've recently needed to do some caching/pooling/reusing of parsed skeleton data in the Cococs2d-x runtime, and I haven't found a giveaway solution, so here is mine!

Please note, the static map approach I used is probably unacceptable in many games, unless it's as simple as mine. If I load every single png in my asset bundle at once, it hardly takes 20 - 30 MB uncompressed, so meh for now.

http://mazyod.com/blog/2014/10/10/spine ... cocos2d-x/

(DISCLAIMER: Yes, this is a shameless plug to my blog, but it's a neat blog without ads, and hey! Sharing for the greater good here 🙂 )

Related Discussions
...
  • Đã chỉnh sửa

Thanks for sharing! 🙂 You could get rid of the map look up the first time through, but it's not an issue.

Caching is not done by default because doing so makes assumptions about how long the SkeletonData is kept around.

10 tháng sau

I think you need to do retain() on the SkeletonRenderer* objects you put in the map.
While looking in the code I didn't understand how spine knows the atlas data, as it only receives spSkeletonData. Maybe this is a bug?