Thanks, I've now switched to non-targeted version. I managed to get my prototype running in the browser (originally written in JS for iPhone), I'm amazed at how this all is coming together :)
I have a few questions about porting and compatibility:
- how are cc.associateWithNative handled? The html version didn't seem to mind, although their code uses this._super()
- is there a recommended way to get both versions running in a compatible way? What I did was create a main-iphone.js file where I put the 'run' function, and then have a separate main.js file which extends cc.Application and runs it from there. Main game logic is in a separate third file used by both of those. It's mainly working except that I couldn't get both versions to run the same way, i.e. the html-5 version:
var ConnectScene = cc.Scene.extend({
onEnter:function () {
this.associateWithNative(this, cc.Scene);
var layer = new MainMenuLayer();
this.addChild(layer);
}
});
// and then director.runWithScene(new ConnectScene()) in main.js
The iPhone version gave me an error here:
jsb: ERROR in jsval_to_nsobject: Error obtaining proxy
So I had to use the 'run' function from the sample. Not a big deal but I don't really understand the issue.
I had to add
cc.Scene.extend = cc.Class.extend;
to jsb constants file.
After that I got it working. But for some reason, it's as if the anchor for the html5 version is not in the middle of the canvas - my whole game is centered around lower-left corner, and I haven't been able to find a way to fix that.
(EDIT: I found the problem eventually - from my main menu I was running replaceScene({a layer}) instead of {the scene} which I prepared. It worked fine on the iPhone but not in html. Now I have the whole prototype working in browser, woohoo! :) )
In any case, thanks for the great work!