Changing ScriptingCore flow of execution of targetted Touch events

This commit is contained in:
Rohan Kuruvilla 2012-10-22 11:02:54 -07:00 committed by James Chen
parent 7ede1373f7
commit c24acd4733
1 changed files with 17 additions and 1 deletions

View File

@ -742,7 +742,23 @@ int ScriptingCore::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSe
int ScriptingCore::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch) int ScriptingCore::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch)
{ {
return 0; std::string funcName = "";
getTouchFuncName(eventType, funcName);
JSObject *jsretArr = JS_NewArrayObject(this->cx, 0, NULL);
JS_AddNamedObjectRoot(this->cx, &jsretArr, "touchObject");
int count = 0;
jsval jsret;
getJSTouchObject(this->cx, pTouch, jsret);
JSObject *jsObj = JSVAL_TO_OBJECT(jsret);
executeFunctionWithObjectData(pLayer, funcName.c_str(), jsObj);
JS_RemoveObjectRoot(this->cx, &jsObj);
removeJSTouchObject(this->cx, pTouch, jsret);
return 1;
} }
int ScriptingCore::executeFunctionWithObjectData(CCNode *self, const char *name, JSObject *obj) { int ScriptingCore::executeFunctionWithObjectData(CCNode *self, const char *name, JSObject *obj) {