Javascript bindings removed?

Javascript bindings seems to be removed from the develop branch.
[[https://github.com/cocos2d/cocos2d-x/tree/develop/cocos/scripting]]
Has it been moved elsewhere?

Please check this repo : https://github.com/cocos2d/cocos2d-js
JSB will be shipped with html5.

Cool thanks.

I am facing in issue extending classes in javascript. For example ParticleSystem class constructor and initWithFile is made protected. Which means I won’t be able to extend the class in javascript. We extend all cc.XXX classes to add some custom functionality and use methods such as ParticleSystem::initWithFile, but even this method is protected. I think classes should be allowed to extend and not be restricted to cc.XXX.create methods.

Hi, @smshuja

We are working on this, we will try to create an easier workflow for extending classes in Html5 and JSB. The direction may be that we want users to forget about init functions, and extend by constructor directly or use setXXX functions to do the similar work as initXXX. It will be published in Cocos2d-html5 v3.0 a2.

Huabin

@smshuja Can you tell us which classes you are extending from the engine?

Thanks Huabin, thats great news!

I was trying to extend ParticleSystem class with JSB in javascript. I even tried moving the constructors for ParticleSystem and ParticleSystemQuad and initWithFile functions to public and generated the bindings, but it gives “error: memory read failed for 0x0”.

Example

ParticleSystem = cc.ParticleSystem.extend({
    ctor: function() {
        this._super();
        cc.associateWithNative( this, cc.ParticleSystem );
        this.initWithFile(particleFile);
        return this;
    }
}

the error happens in initWithFile function. What else needs to be done to get this to work?

@pandamicro wrote:

Hi, @smshuja

We are working on this, we will try to create an easier workflow for extending classes in Html5 and JSB. The direction may be that we want users to forget about init functions, and extend by constructor directly or use setXXX functions to do the similar work as initXXX. It will be published in Cocos2d-html5 v3.0 a2.

Huabin

please do not change api a lot
just like iOS7, almost each UI control can not work correctly on iOS7
worst upgrade in history

Changing API to standardize the cocos2d-x, html5 and JSB is a good thing. But the flexibility should not be taken away.

@smshuja

We are working on the problem of inheritance for the next release, unfortunately, we didn’t have enough time to make it all right in v3.0a. But we do proposed the inheritance for many basic classes, like: cc.Node, cc.Sprite, cc.Layer and all its descendants, cc.Menu, cc.MenuItem, cc.MenuItemFont, cc.MenuItemToggle. They are already extendable in v3.0a. The ParticleSystem case was a little bit complicated, so it’s not done yet in this version. But I guarantee you that the inheritance will work perfectly for the next version.

Huabin

Hi, @teriyaki

Can you be more specific about the problem your met on iOS 7? I just tested with our test case, there is no problem. Or you can give us some test code, and we really appreciate feedbacks for bugs.

As for the API changes, I totally understand that you are not happy with that much changes, and we know that is not easy to upgrade from 2.x to 3.0a, that’s why we created many docs to explain the reason and how to upgrade. Maybe that’s not enough, but we will continue to provide more guides and informations to make things easier.
Here is the upgrade guide with links of other documents in it: http://www.cocos2d-x.org/docs/manual/framework/html5/release-notes/v3.0a/upgrade-guide/en

What has driven us to change that much, is that our engine is really not easy to use for Javascript developers, and yet we are writing JS not C++ with Cocos2d-html5 and JSB, so we are sure it will be much better if our engine has a real JS style API for new developers of our engine. However, for developers that have already get used to the old C++ style API, it means to readapt, take time to upgrade, and so on. What I can ensure you is that it worth the effort, we will keep on improving Cocos2d-html5 and JSB.

Let’s write less and play more !

Huabin

Thanks @pandamicro
Looking forward to the final release.

Hi. What about the javascript bindings for C++ pluginx? They were removed but I do not see them added to Cocos2d-JS yet. Where did they go?