CCLayer注册lua回调函数setTouchPriority失效
来源:互联网 发布:淘宝店招如何全屏 编辑:程序博客网 时间:2024/06/07 04:59
CCLayer注册lua回调函数setTouchPriority失效:方式1、不行 touchLayer:setTouchPriority(-5000) touchLayer:registerScriptTouchHandler(touchLayerCallFunc) touchLayer:setTouchEnabled(true) maskLayer:addChild(touchLayer) 方式2、可以touchLayer:registerScriptTouchHandler(touchLayerCallFunc, false, -5000, true)touchLayer:setTouchEnabled(true)maskLayer:addChild(touchLayer)原因:void CCLayer::registerWithTouchDispatcher(){ CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher(); // Using LuaBindings /* 我们使用registerScriptTouchHandler方法注册了回调,所以m_pScriptTouchHandlerEntry不为空: void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches){ unregisterScriptTouchHandler(); m_pScriptTouchHandlerEntry = CCTouchScriptHandlerEntry::create(nHandler, bIsMultiTouches, nPriority, bSwallowsTouches); m_pScriptTouchHandlerEntry->retain();} */ if (m_pScriptTouchHandlerEntry) { if (m_pScriptTouchHandlerEntry->isMultiTouches()) //多点触摸 { pDispatcher->addStandardDelegate(this, 0); LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptTouchHandlerEntry->getHandler()); } else //单点触摸 { //注意这里和C++的不同,这个的优先级和是否吞噬,都是CCTouchScriptHandlerEntry类中的成员变量, //也就是我们调用registerScriptTouchHandler方法传进来的值,而不是通过setTouchPriority方法设置 //的m_nTouchPriority成员变量,这个变量对于lua没用。 pDispatcher->addTargetedDelegate(this,m_pScriptTouchHandlerEntry->getPriority(),m_pScriptTouchHandlerEntry->getSwallowsTouches()); LUALOG("[LUA] Add touch event handler: %d", m_pScriptTouchHandlerEntry->getHandler()); } } else { if( m_eTouchMode == kCCTouchesAllAtOnce ) { pDispatcher->addStandardDelegate(this, 0); } else { //C++中调用优先级才会用到m_nTouchPriority变量,即可以通过setTouchPriority方法设置。 pDispatcher->addTargetedDelegate(this, m_nTouchPriority, true); } }}
0 0
- CCLayer注册lua回调函数setTouchPriority失效
- LUA和C/C++交互-注册回调函数
- Lua回调函数小结
- Lua回调函数小结
- Lua回调函数小结
- GLUT-注册回调函数
- 回调函数_注册
- cocos2d-x 2.2.0 如何在lua中注册回调函数给C++
- cocos2d-x 2.2.0 如何在lua中注册回调函数给C++
- cocos2d-x lua 回调函数
- 注册SMS接收回调函数实例
- SEH的注册回调函数
- 注册回调函数处理SQLITE_BUSY错误
- 回调函数与注册函数
- VC学习之注册回调函数
- c++ 注册回调函数研究
- J2V8 -- 注册 Java 回调函数
- CCLayer的优先级设置函数setTouchPriority()不生效
- Gh0st源码学习(三)生成DLL和DAT文件
- 使用javaswing设定背景图片为窗体大小(原创)
- php 5.4.38
- oracle wallet使用与维护
- 大规模数据相似度计算时,解决数据倾斜的问题的思路之一(分块思想)
- CCLayer注册lua回调函数setTouchPriority失效
- 11G 结果集缓存限制
- linux shell教程(一)
- 八、通过中缀计算表达式转换成后缀计算表达式
- A除以B
- Android应用开发中如何使用隐藏的API
- mysql 怎么把查询结果作为表名继续查询
- Tomcat源码阅读(三)Catalina.createStartDegester
- HDR和bloom效果的区别和关系