首页 > 代码库 > quick_cocos2dx 点击事件

quick_cocos2dx 点击事件

local function onTouchBegan(x, y) 层单击事件

end

local function onTouchMoved(x, y)
end

local function onTouchEnded(x, y)
print("哈哈哈")
end
local function onTouch(eventType, x, y) --触发函数
if eventType == "began" then
return true
elseif eventType == "ended" then
return onTouchEnded(x, y)
end
end
layer:setTouchEnabled(true)
layer:registerScriptTouchHandler(onTouch)