Tips for porting cocos2d-iphone to cocos2d-x

Tips for porting cocos2d-iphone to cocos2d-x
0.0 0



I’ve got a client for my game written in cocos2d and I would like to port it to cocos2d-x in order to have one source tree to support ios and android.
It is not graphics intensive game, however it involves some gl scissors cutting here and there.
I am using GDataXML and LRResty frameworks to support easy xml parsing and communication with my server.
I’ve tried using corona SDK, but it’s not sufficient for me [the game is mostly a graphical interface, it’s got lots of windows/lists etc. - I am using glscissors to create tables with nice cutting].
I have to admit, I’ve had some C*+ experience in the past, but it was long time ago back in university. Since then I was mostly dealing with enterprise web apps - thus needed Java mostly :wink:
So I’ve got this few questions I:

  1. Are there any alternatives to GDataXML and LRResty written in C**, which I could use in cocos2d-x?
  2. This is more of a c*+ question rather than cocos2d-x but still, hopefully you guys will be able to answer: how should I port properties from objc? Is there a template someone could recommend?
  3. Are there any gotchas I should know when porting from cocos2d-iphone? I am still using 0.99.x release of cocos2d so there’s no worry about introducing something new that is not supported in cocos2d-x.

Sorry for a beginner question but this is a starting point for me. The main task I have is to port is as good as possible and in as little time as possible.

  1. libxml2 is recommend. You can refer to CCSAXParser.cpp in cocos2d-x for its usage
  2. We have defined some marcos in cocos2d-x/platform/CCPlatformMacros.h, such as CC_PROPERTY, CC_PROPERTY_READONLY, CC_PROPERTY_PASS_BY_REF, you can use these marcos to easily port properties from objc to c++. Search CC_PROPERTY in cocos2d-x framework for its usage
  3. In early age of cocos2d-x, we have written [[Rules of translating objc to cpp]] to standardize our porting job. This document may be helpful to you now.


Thanks a lot!
This is exactly what I was looking for.
The only thing that is left for me to figure out is some kind of framework to handle requests and responses to/from my server.



Does libcurl meets your need?


libcurl seems like overly complicated for my need of passing url string and receiving string with the response & http status.
I’m not sure if I understood right, to use it in an asynchronous manner I will have to use the multi interface rather then easy, correct?
This seems like something I will have to dig deeper in, thought it should benefit in future.