• Runtimes
  • Using spine-cocos2d-objc runtime

Related Discussions
...

Hello guys,

I'm currently working as a programmer at a game development company. Our company is using flash animations for the games and currently thinking to switch to spine. For that reason I'm trying with spine now to give a feedback to my boss.

I'm trying to add the cocos-2d-objc runtime in my cocos-2d-iphone project for a test. I downloaded the runtime from your official source. Firstly I got stucked for including the files as directed in the download link. But I recovered the problem and having a new one. The project is now including the runtime files but giving some errors in extension.h and SkeletonAnimation.h files. I'm attaching some screen shots of my x-code to show you the errors.

Attachments for the SkeletonAnimation.h file:

Attachment for the extension.h file:

I was searching over the google and your forum also but not getting any solution regarding this. I'll be very glad to know how to get rid out of this.

Thank you

Thanks for the report. spine-objc does not support ARC at the moment, as outlined by the errors above. I've created an issue here [cocos2d-objc] Make runtime compatible with ARC · #946

All that said, I'd recommend you to look into engines other than cocos2d-objc. It's been superseded by cocos2d-x, and is not really maintained a lot anymore. It also only works on iOS, which limits your target platforms a lot.

Thnx a for having a time for me and for your recommendation. But our company has already a lot of games in the market. So if we think to switch to a new engine then what to be done with the old projects? Though switching to a new engine wouldn't be possible easily for us.

Oh, I did not mean to say you must switch, just that it is probably the sane way to do, since cocos2d-objc is not really actively maintained anymore, see http://forum.cocos2d-objc.org/t/the-future-of-cocos2d-objc/17549

For the issue at hand, you can disable ARC for all the files in spine-cocos2d-objc/ by adding -fno-objc-arc. See https://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project for a more detailed explanation.

Making cocos2d-objc ARC compatible out of the box would mean that it won't work for projects that do not use ARC. It's an either/or thing from what I can tell. Using the -fno-objc-arc flag on the files is a sensible work around.

Thanks a lot badlogic. Your second reply helped to get solved the ARC problems. But I'm still suffering from the problem of the extension.h file. The redefinition of '_realloc' error is still showing there. Can you say something about that please?

One more thing I wanna add. After getting the ARC error removed I got some new ones. I became able to remove those also but more errors were found. After getting and removing new errors for thrice or more now I'm stucked with the error of the extension.h file.

Thank you again

Could you send me a project that reproduces the error? I tried the cocos2d-objc project generator but that seems to be broken. Our cocos2d-objc sample is based on an older template that has ARC disabled.

I was trying to add the runtime in a new cocos2d-iphone project. I can send you the project if you want. I already sent two zip folders to contact@esotericsoftware.com

I found the e-mail address in other forum posts. If I need to send the files to another e-mail, I'll request you to provide that.

I sent two folders named SpineTest and SpineTest2. Both of them are new cocos2d-iphone project. In the SpineTest project firstly I tried to add the runtime files according to the instructions found in the runtime download page. But the files weren't found by the project when I tried to build that. Later the files were found when I added the files in another way. After that the files were found by the project but the errors found.

In SpineTest2 actually there is almost nothing. This project is representing the runtime files not found condition. In that project I tried to add runtime again following the runtime download page instruction but failed. I just added this project to show you the failure of adding runtime to that.

Thanks a lot again badlogic for having such time for me.

I got the project via email and am looking into it. Will reply here.

I've changed the spine-c runtime so there are no name collisions with what cocos2d-objc defines. It's in the 3.6 and 3.7-beta branch on GitHub. I also send you SpineTest.zip fixed up via email. I'm fixing up the README file in the spine-cocos2d-objc project to reflect better how to integrate Spine. Thanks for reporting!

It appears you specified the include paths wrong, this is what you need

Thnx a lot again badlogic. Finally I'm able to build the project. Hope to see spine animations in our games soon. 🙂

Cool, keep us posted 🙂