[ASK] Tools for porting cocos2d-iphone games to cocos2d-x (Obj-C to C++)

Hi guys,

I’m going to port a game written with cocos2d-iphone (Obj-C) to cocos2d-x (C**) so that it can run on Android.
The process of porting Obj-C code to C** code is quite tedious. Is there any tool or method we can use to fasten the code-translation process?

Hello Stefan Nguyen. Try this:
http://www.apportable.com/
and http://2sa-studio.blogspot.fr/2013/06/from-ios-to-android-with-apportable.html

Tobias S wrote:

Hello Stefan Nguyen. Try this:
http://www.apportable.com/
and http://2sa-studio.blogspot.fr/2013/06/from-ios-to-android-with-apportable.html

Thanks, Tobias! Apportable seems to be nice and your article is great :wink:
However, I still don’t know how to handle platform-specific libraries/frameworks. In your article, you just ignore TestFlight lib, but what about Game Center, In App Purchase…? We need these functions in Android version as well.

You’re going to be recoding things like Game Center and In App Purchase to use the Google services, which are slightly different than the Apple version.

I’ve converted a lot of Objective-C code to C++ — a little bit of scripting, Visual Studio and some patience.

Cory Trese wrote:

You’re going to be recoding things like Game Center and In App Purchase to use the Google services, which are slightly different than the Apple version.
>
I’ve converted a lot of Objective-C code to C++ — a little bit of scripting, Visual Studio and some patience.

Thanks, Cory. But how do I rewrite some part of the game while the rest is being processed by Apportable?

Btw, can you tell us more about the scripts you wrote to speed up the porting process?

Well, the “easiest” solution using AppPortable would be, in my opinion, to strip the game of iOS specific parts to a still working version with just core functionality, then use AppPortable to convert the code, and then add those platform specific parts for Android.

Pawel Lopusinski wrote:

Well, the “easiest” solution using AppPortable would be, in my opinion, to strip the game of iOS specific parts to a still working version with just core functionality, then use AppPortable to convert the code, and then add those platform specific parts for Android.
Apportable doesn’t convert code, it compiles Objective-C instead.

@Sergey : This changes a lot :smiley:

AppPortable has reimplemented a lot iOS libraries (not all of them), but nobody can assure your code is going to behave exactly the same, as different implementations can have bugs.

And you cannot expect Apportable to update their libraries as soon as Apple does.

I’d go the manual way.