Cocos 2d-x 3.6 touch事件只有began 坑~
touch事件只有began
-- add touch layer display.newLayer() :onTouch(handler(self,self.onTouch)) :addTo(self) 少了这个return,让哥的touch事件只有began,framework就是这么菜 cocosframeworkextendsLayerEx.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 returncallback(event) end,宋体"> self:setTouchEnabled(true) return self end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |