multi touch - Detect X and Y of Each Multitouch Event in Corona SDK -


after activating multitouch in corona sdk, there way can track x , y coordinates of each simultaneous touch?
ideal function this:
local function detectmultitouch(touches)
= 0, #touches do
print(touches[i].x .. " ".. touches[i].y) end
end

you can try this

system.activate("multitouch")  local touches = {} local touchids = {}  local function detectmultitouch()     = 1, #touchids         print("#"..i.." "..tostring(touchids[i]) .." = "..touches[touchids[i]].x..","..touches[touchids[i]].y)     end end  runtime:addeventlistener("touch",function(event)     if event.phase == "began"         touches[event.id] = {}         touches[event.id].x = event.x         touches[event.id].y = event.y         touches[event.id].coords = display.newtext(tostring(event.id).." = "..touches[event.id].x..","..touches[event.id].y,0,0,system.nativefont,15)         touches[event.id].coords.x = touches[event.id].x         touches[event.id].coords.y = touches[event.id].y          table.insert(touchids,event.id)     elseif event.phase == "moved"         touches[event.id].x = event.x         touches[event.id].y = event.y         touches[event.id].coords.text = tostring(event.id).." = "..touches[event.id].x..","..touches[event.id].y         touches[event.id].coords.x = touches[event.id].x         touches[event.id].coords.y = touches[event.id].y - 20     elseif event.phase == "ended"         touches[event.id].coords:removeself()         touches[event.id] = nil         table.remove(touchids,table.indexof(touchids, event.id))           detectmultitouch(touches)     end end) 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -