Hi guys,
sorry for announcing this so late, but here it goes:
My name is Rolando and I’ve been working on the cocos2d-x-javascript bindings for a while. We (Zynga) released as open source the branch old-js-bindings, that was using JavaScriptCore last week and right now we’re openly working on a new, better, improved, faster, javascript bindings using SpiderMonkey. You can check the progress in my personal fork (I’ll be merging code to the cocos2d-x project as it gets stable):
Why we moved from JavaScriptCore to SpiderMonkey?
Apparently everyone is using JavaScriptCore, but although that seems to be true, they are all infringing the LGPL license (actually Apple is infringing the License), so we searched for other JavaScript VMs and decided that SpiderMonkey was a good candidate. We got it working on iOS and Android fairly easy:
And we’re using that on the new bindings.
How do the new bindings work?
We’re going to build them in a two step process: we want to create a simple script that will parse the cocos2d.h header file and automagically create the bindings for cocos2d-x (or any other C/C++ project for that matter). We’re half-way through with this script and you can check the progress in my fork. The script is using clang to produce an xml for the AST, so that makes it very powerful. This script will only get us that far: producing a 1-1 mapping of the API. Although that’s a good thing, is not what we’re aiming, we want to have a very javascript-friendly and awesome API, leaving room for a future where you could code your game in javascript and run it natively (using cocos2d-x) on your device, or using another port of cocos2d on the browser.
The second part will be written in javascript, we’re going to take the 1-1 API conversion and we’re going to wrap it to make it more appealing for javascript developers. We’re going to start on that as soon as we finish the automatic bindings.
As you can see, we decided to move with this in the open source model, so you can join us in the fun and contribute (either just testing, bug reporting, or with code) to this project to make it even better.
What is working today?
We have a working SpiderMonkey for iOS and Android and basic autobindings for properties (fundamental, pointer and reference types), classes and a few other things. We’re adding functions/constructors support as I write this, so that should be there pretty soon. You can check the Readme in the js directory in the js-bindings branch to test it.
Anyway… that’s it, I hope you’re all as excited as we are regarding this project and hopefully you’ll be coding your games in javascript pretty soon
Rolando