0

I wrote a cocos2d-html5 app. Due to performance issues I need to port it to native cocos2d-iphone. How can I do it easily. I heard about javascript-bindings and stuff like that. I'm not sure if this is possible. What is the best way to proceed ?

Claudio Ferraro
  • 4,551
  • 6
  • 43
  • 78

1 Answers1

3

You can use cocos2d-x with the JavaScript bindings, the API is 1-1 with cocos2d-html5: http://www.cocos2d-x.org/.

Also checkout the sample game using the JavaScript bindings on github: https://github.com/jhurt/cocos2d-x/tree/gles20/samples/MoonWarriors

Jason Hurt
  • 133
  • 5
  • Ok.. thank you will check. But can I even call native functions different than Cocos2d through javascript ? for example if I wanna to interface to the facebook api or the IOS sdk , can I do this through bindings ? – Claudio Ferraro Sep 12 '13 at 20:11
  • Yes you can call C from JavaScript and then call into the Facebook or iOS SDKs in Objective-C from your C code. cocos2d-x uses the SpiderMonkey JavaScript engine so the bindings you write (or generate) are specific to [SpiderMonkey](https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_User_Guide). I would checkout the [jsbindings](https://github.com/zynga/jsbindings) project on github for details. – Jason Hurt Sep 20 '13 at 22:59
  • It's a really great tool the javascript binding. Thank you to the creator. – Claudio Ferraro Sep 25 '13 at 13:10