Note: Sorry about the links. I can't seem to use [url] tags.
Hi I've been working with the official cocos2d-iphone runtime for Objective-C and it's been working great so far. I have been having trouble trying to programmatically set an image on a spine animation. In short, what I would really like to do is to create a RegionAttachment from a dynamic UIImage/CCSprite and set it into an existing slot of my animation. I did some searching and found a thread that is similar to what I am trying to do: http://esotericsoftware.com/forum/viewtopic.php?f=7&t=1870
This thread lead me to another thread with an answer: http://esotericsoftware.com/forum/viewtopic.php?f=3&t=1554&p=7796&hilit=+cocos2d+attachment#p7627
I've been following the answer in this second thread, but I have been having trouble adapting it for the latest version of spine and cocos2d v3.4. I've been having two main problems.
- ) The implementation in the answer in the second link above shows creating a CCTextureAtlas from a CCTexture2D in the following method:
-(RegionAttachment*) regionWithTexture2d:(CCTexture2D*)tex2d name:(NSString*)_name{
CCTextureAtlas *tex = [[CCTextureAtlas alloc] initWithTexture:tex2d capacity:128];
...
However in cocos2d v3.4, CCTextureAtlas has been retired. I've been trying to work around it by using a CCTexture instead and setting that directly as the renderObject, but I'm not sure if this is correct.
2.) The original implementation also created an AtlasPage with just a name before as follows:
AtlasPage *page = AtlasPage_create([_name UTF8String]);
However in the latest spine version, the AtlasPage_create() requires an Atlas and name as follows:
spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name);
I'm not sure what to put as the atlas here. I've tried to put different things into spAtlas_create() or spAtlas_createFromFile(), but no matter what I do it just seems to crash.
Any help anyone can offer will be greatly appreciated! Thank you!