I am exploring the possibility of using cocos2d-js by inserting it as a view inside an existing iOS application. To do this, I will need a two-way communication between cocos2d and the surrounding application.
After some initial research, I decided that using ScriptingCorecan call in , using ScriptingCore:
ScriptingCore* sc = ScriptingCore::getInstance();
jsval outVal;
sc->evalString("function()", &outVal);
My question is to do the opposite. Is it possible (for example, in response to user input) to call back from cocos2d-js in C ++? Ideally, there would be a way to register a callback using ScriptingCorethat which can be called from JavaScript.
source
share