Cocos 2d-x 3.6 touch事件只有began 坑~
来源:互联网 发布:腾讯数据库有多大 编辑:程序博客网 时间:2024/05/17 05:14
touch事件只有began
-- add touch layer
display.newLayer()
:onTouch(handler(self, self.onTouch))
:addTo(self)
少了这个return,让哥的touch事件只有began,framework就是这么菜
cocos\framework\extends\LayerEx.lua
function Layer:onTouch(callback, isMultiTouches, swallowTouches)
if type(isMultiTouches) ~= "boolean" then isMultiTouches = false end
if type(swallowTouches) ~= "boolean" then swallowTouches = false end
self:registerScriptTouchHandler(function(state, ...)
local args = {...}
local event = {name = state}
if isMultiTouches then
args = args[1]
local points = {}
for i = 1, #args, 3 do
local x, y, id = args[i], args[i + 1], args[i + 2]
points[id] = {x = x, y = y, id = id}
end
event.points = points
else
event.x = args[1]
event.y = args[2]
end
return callback(event)
end, isMultiTouches, 0, swallowTouches)
self:setTouchEnabled(true)
return self
end
- Cocos 2d-x 3.6 touch事件只有began 坑~
- cocos-2d-x 资料
- cocos 2d-x 动作
- Cocos 2d-x Console模块
- cocos 2d-x 中文乱码
- cocos 2d-x 3.0环境配置
- Cocos 2d-x 学习第三天
- quick-cocos-2d-x学习
- cocos-2d-x学习笔记
- cocos 2d x 创建文本按钮
- cocos2dx3.2关于cocos studio中button的touch事件
- cocos.py 2.0 - cocos console: cocos 2d-x.....Traceback (most recent call last)
- cocos2d-x touch事件
- cocos2d-x touch事件
- cocos2d-x touch事件
- coco2d-x touch事件
- Cocos2d-x---Touch事件
- mac 搭建cocos-2d-x 2.2以上版本。
- 验房的注意事项
- Android之AsyncTask异步加载
- PE格式详细讲解8 – 输入表
- STL中的所有容器资料
- 《机器学习实战》学习笔记:绘制树形图&使用决策树预测隐形眼镜类型
- Cocos 2d-x 3.6 touch事件只有began 坑~
- 解决android:background背景图片被拉伸问题
- [leetcode][Binary Search] H-Index II
- android学习笔记(17)广播事件处理进阶(注册方法)
- IOS中宏定义
- java 解决中文乱码
- Swift UIButton UIButtonType
- android 制作9.png图片
- Go环境搭建