cocos2d-x jsb 绑定 removeAllDelegates

html5版为

cc.Director.getInstance().getTouchDispatcher().removeAllDelegates();

但 jsb 下没有,绑定一下。

void JSTouchDelegate::removeAllDelegates() {
    CCDirector* pDirector = CCDirector::sharedDirector();
    pDirector->getTouchDispatcher()->removeAllDelegates();
}


JSBool js_cocos2dx_JSTouchDelegate_removeAllDelegates(JSContext *cx, uint32_t argc, jsval *vp)
{
	if (argc == 0) {        
        JSTouchDelegate *touch = new JSTouchDelegate();
        touch->autorelease();
        touch->removeAllDelegates();
		return JS_TRUE;
	}
    JS_ReportError(cx, "wrong number of arguments");
	return JS_FALSE;
}


JS_DefineFunction(cx, ns, "removeAllDelegates", js_cocos2dx_JSTouchDelegate_removeAllDelegates, 1, JSPROP_READONLY | JSPROP_PERMANENT);

发表评论

电子邮件地址不会被公开。 必填项已用*标注