MCPcopy Create free account
hub / github.com/9miao/CrossApp / executeLayerTouchesEvent

Method executeLayerTouchesEvent

scripting/javascript/bindings/ScriptingCore.cpp:817–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

815//}
816
817int 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
846int ScriptingCore::executeLayerTouchEvent(CAView* pLayer, int eventType, CATouch *pTouch)
847{

Callers

nothing calls this directly

Calls 6

getTouchesFuncNameFunction · 0.85
getJSTouchObjectFunction · 0.85
removeJSTouchObjectFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected