The setTouchPriority Of The lua callback function registered by CCLayer is invalid. The lua callback function

Source: Internet
Author: User

The setTouchPriority Of The lua callback function registered by CCLayer is invalid. The lua callback function

The setTouchPriority callback function of the CCLayer registration lua is invalid: method 1. touchLayer: setTouchPriority (-5000) touchLayer: touchLayerCallFunc) touchLayer: setTouchEnabled (true) maskLayer: addChild (touchLayer) method 2: touchLayer: callback (touchLayerCallFunc, false,-5000, true) touchLayer: setTouchEnabled (true) maskLayer: addChild (touchLayer) cause: void CCLayer: callback () {CCTouchDi Spatcher * pDispatcher = CCDirector: sharedDirector ()-> getTouchDispatcher (); // Using LuaBindings/* we registered the callback Using the registerScriptTouchHandler method, so the callback is not empty: void CCLayer :: registerScriptTouchHandler (int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches) {response (); response = CCTouchScriptHandlerEntry: create (nHandler, bIsMulti Touches, nPriority, bSwallowsTouches); m_pScriptTouchHandlerEntry-> retain ();} */if (dependencies) {if (m_pScriptTouchHandlerEntry-> isMultiTouches ()) // multi-touch {pDispatcher-> addStandardDelegate (this, 0); LUALOG ("[LUA] Add multi-touches event handler: % d ", m_pScriptTouchHandlerEntry-> getHandler ();} else // single point of touch {// note that this is different from C ++. The priority and whether this is swallowed are all member variables in the CCTouchScriptHandlerEntry class, // that is, we call r The value passed in by the egisterScriptTouchHandler method, instead of the m_nTouchPriority member variable set by the setTouchPriority method. This variable is useless for lua. PDispatcher-> addTargetedDelegate (this, response-> getPriority (), m_pScriptTouchHandlerEntry-> getSwallowsTouches (); LUALOG ("[LUA] Add touch event handler: % d ", m_pScriptTouchHandlerEntry-> getHandler () ;}} else {if (m_eTouchMode = kCCTouchesAllAtOnce) {pDispatcher-> addStandardDelegate (this, 0 );} the m_nTouchPriority variable is used only when the call priority in else {// C ++ is called. That is, the parameter can be set using the setTouchPriority method. PDispatcher-> addTargetedDelegate (this, m_nTouchPriority, true );}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.