I’ve been using the JS Bindings since it was introduced into cococs2d-2.x. And I’d like to thank all people involved in developing this framework. It’s awesome to use across different platforms.
Ok enough of the praise
The Back & Home keys are not implented for layers in ScriptingCore the function simply returns 0.
So I’ve implemented it and it seems to work properly on our Android test devices. The code snippet to replace with:
int ScriptingCore::executeLayerKeypadEvent(CCLayer* pLayer, int eventType)
jsval retVal, jsValArr = JSVAL_ZERO;
js_proxy_t * p;
if (!p) return false;
executeJSFunctionWithName(this->cx_, p->obj, "onKeyBackClicked", jsValArr, retVal);
executeJSFunctionWithName(this->cx_, p->obj, "onKeyHomeClicked", jsValArr, retVal);
I used the “on” prefix to reflect how it’s used in the cocos2d-html5 branch. If someone would be kind enough to make a patch so that this makes it into the git repos that would be awesome.
Thanks again for a great framework!