| 815 | //} |
| 816 | |
| 817 | int ScriptingCore::executeLayerTouchesEvent(CAView* pLayer, int eventType, CCSet *pTouches) |
| 818 | { |
| 819 | std::string funcName = ""; |
| 820 | getTouchesFuncName(eventType, funcName); |
| 821 | |
| 822 | JSObject *jsretArr = JS_NewArrayObject(this->cx_, 0, NULL); |
| 823 | |
| 824 | JS_AddNamedObjectRoot(this->cx_, &jsretArr, "touchArray"); |
| 825 | int count = 0; |
| 826 | for(CCSetIterator it = pTouches->begin(); it != pTouches->end(); ++it, ++count) { |
| 827 | jsval jsret; |
| 828 | getJSTouchObject(this->cx_, (CATouch *) *it, jsret); |
| 829 | if(!JS_SetElement(this->cx_, jsretArr, count, &jsret)) { |
| 830 | break; |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | executeFunctionWithObjectData(pLayer, funcName.c_str(), jsretArr); |
| 835 | |
| 836 | JS_RemoveObjectRoot(this->cx_, &jsretArr); |
| 837 | |
| 838 | for(CCSetIterator it = pTouches->begin(); it != pTouches->end(); ++it, ++count) { |
| 839 | jsval jsret; |
| 840 | removeJSTouchObject(this->cx_, (CATouch *) *it, jsret); |
| 841 | } |
| 842 | |
| 843 | return 1; |
| 844 | } |
| 845 | |
| 846 | int ScriptingCore::executeLayerTouchEvent(CAView* pLayer, int eventType, CATouch *pTouch) |
| 847 | { |
nothing calls this directly
no test coverage detected