Cocos2d -> Cocos2dx rewrite Update 1 (4 Hours)

I am 4 hours into the conversion. I decided to just go scene by scene, so I began by loading in my splash screen and loading scene. The loading scene is something I wrote for cocos2d a while ago and use it in many apps, it’s available on github (although I do need to update that one as I’ve made a couple small enhancements). So I took that and ported it all to cocos2d-x. This was a great place to start because it has some file reading / parsing code in there.

I haven’t done this before on cocos2d-x, and I must say they’ve done a great job. I am able to use all my existing dictionaries (plist) files and parse them just as I did previously, so it was just a matter of updating the syntax to C++ from OBJC and away I went. So in my loading class I do a few things, first I cache all my sprite sheets, sounds, images, etc, then for this game I generate the dictionary which will be used for the game. This is some custom code I have, so it needed to be converted as well. Thankfully most of the code was in C++ already, as that’s usually how I write my performance code. So it was simply going from NSArrays to CCArrays, and changing a few types here and there.

All in all, after 4 hours, I did the whole loading screen, splash screen, and 90% of the core engine. So by going this path, I’ve actually tackled the more technical bits first, as displaying things on the screen is much easier code to migrate. So I think at 8% done I’m making great time.

Next Post:
Posted in: Developer Journal

Leave a Reply