| 943 | |
| 944 | |
| 945 | int ScriptingCore::executeCustomTouchesEvent(int eventType, |
| 946 | CCSet *pTouches, JSObject *obj) |
| 947 | { |
| 948 | jsval retval; |
| 949 | std::string funcName; |
| 950 | getTouchesFuncName(eventType, funcName); |
| 951 | |
| 952 | JSObject *jsretArr = JS_NewArrayObject(this->cx_, 0, NULL); |
| 953 | JS_AddNamedObjectRoot(this->cx_, &jsretArr, "touchArray"); |
| 954 | int count = 0; |
| 955 | for(CCSetIterator it = pTouches->begin(); it != pTouches->end(); ++it, ++count) { |
| 956 | jsval jsret; |
| 957 | getJSTouchObject(this->cx_, (CATouch *) *it, jsret); |
| 958 | if(!JS_SetElement(this->cx_, jsretArr, count, &jsret)) { |
| 959 | break; |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | jsval jsretArrVal = OBJECT_TO_JSVAL(jsretArr); |
| 964 | executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), funcName.c_str(), 1, &jsretArrVal, &retval); |
| 965 | JS_RemoveObjectRoot(this->cx_, &jsretArr); |
| 966 | |
| 967 | for(CCSetIterator it = pTouches->begin(); it != pTouches->end(); ++it, ++count) { |
| 968 | jsval jsret; |
| 969 | removeJSTouchObject(this->cx_, (CATouch *) *it, jsret); |
| 970 | } |
| 971 | |
| 972 | return 1; |
| 973 | } |
| 974 | |
| 975 | |
| 976 | int ScriptingCore::executeCustomTouchEvent(int eventType, |
nothing calls this directly
no test coverage detected