CCLayer的优先级设置函数setTouchPriority()不生效
2014-05-06 18:53
204 查看
cocos2dx 2.2.3版本, 对于CCLayer的优先级设置函数setTouchPriority()居然不起作用,我表示非常的愤懑
因为CCLayer的触摸事件注册函数用到的priority为 m_pScriptTouchHandlerEntry->getPriority(),该值为函数
void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)设置
而非setTouchPriority()设置的值
void CCLayer::registerWithTouchDispatcher()
{
CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();
// Using LuaBindings
if (m_pScriptTouchHandlerEntry)
{
if (m_pScriptTouchHandlerEntry->isMultiTouches())
{
pDispatcher->addStandardDelegate(this, 0);
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptTouchHandlerEntry->getHandler());
}
else
{
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 {
pDispatcher->addTargetedDelegate(this, m_nTouchPriority, true);
}
}
}
cocos2dx 2.2.3版本, 对于CCLayer的优先级设置函数setTouchPriority()居然不起作用,我表示非常的愤懑
因为CCLayer的触摸事件注册函数用到的priority为 m_pScriptTouchHandlerEntry->getPriority(),该值为函数
void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)设置
而非setTouchPriority()设置的值
void CCLayer::registerWithTouchDispatcher()
{
CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();
// Using LuaBindings
if (m_pScriptTouchHandlerEntry)
{
if (m_pScriptTouchHandlerEntry->isMultiTouches())
{
pDispatcher->addStandardDelegate(this, 0);
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptTouchHandlerEntry->getHandler());
}
else
{
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 {
pDispatcher->addTargetedDelegate(this, m_nTouchPriority, true);
}
}
}
相关文章推荐
- cocos2d-x TestLua 之 设置菜单优先级 setHandlerPriority()
- SetPriorityClass 设置当前程序的优先级
- ceSetThreadPriority设置线程的优先级
- CCLayer注册lua回调函数setTouchPriority失效
- ceSetThreadPriority设置线程优先级~!
- windows编程中关于设置映象模式的四个函数SetWindowOrg SetViewPortOrg SetMapMode SetWindowExtEx SetViewPortExtEx .
- C++ - 库函数优先级队列(priority_queue)输出最小值 代码
- bdb 设置压缩函数set_bt_compress
- signal signal函数每次设置具体的信号处理函数(非SIG_IGN)只能生效一次,多次调用需要调用时在加类似监听的方法!!! 最好用sigaction
- STL中sort、priority_queue、map、set的自定义比较函数
- Audio系列之通用的音量设置函数setStreamVolume()
- SetConsoleWindowInfo 函数--设置控制台窗口的大小和位置
- set_time_limit(0) 设置程序执行时间的函数
- setfillstyle() 设置填充图样和颜色函数
- 用set_terminate设置自己的terminate处理函数
- [android] setOnTouchEvent 设置返回值为true 和 false的区别
- android listvieew PullToRefreshListView设置setOnTouchListener()失效
- 详解Cocos2d 开发关于CCLayer中Touch事件 以及优先级
- PHP设置时区函数date_default_timezone_set
- MFC使用SetFont设置CStatic不生效的问题