- I modeled my approach after CCEditBox, which uses JSB_EditBoxDelegate. I see that a JSB_EditBoxDelegate is allocated in js_cocos2dx_CCEditBox_setDelegate, but I don’t see where it’s freed. Can you point me to this?
Yes, some delegate instances are never released after being created. For this, I don’t have a good way to avoid. But I think it’s not so important since every time a CCEditBox is created and delegate is set, it just wastes 8 byte memory. In normal games, we will not create CCEditBox frequently, right? If you find a better way, feel free to let me know, thanks.
- It looks like there’s no support for taking a JS function object and calling it directly. Is this true? It seems a little odd to have JS pass in strings as callback method names, but I guess that works (and it’s what I’ve done in previous cases when I’ve bound methods manually).
We did support this function, please refer to ScriptingCore::executeFunctionWithOwner, if you want to invoke global function in JS, the first parameter should be OBJECT_TO_JSVAL->getGlobalObject).
- What’s the current coding standard? I’d like to follow the convention as much as possible, but I’ve noticed a few distinct styles in the codebase and I’m not sure which one’s the best one to follow.
Yes, it seems that we should format the code style, you could refer to wiki page about the convention(http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos_Coding_Style).