Hey Scott,
Are you talking about the current Multitouch or the Beta 3 enabled Multitouch?
I played with the Beta 3 version and it looks like it’s doing what you want. I see a “began” touch event for all fingers and if the first finger goes away the other fingers still generate “moved” and “ended” events. Each finger has it’s own event.ID that doesn’t change as long as the finger is till touching the screen.
For the current Multitouch (beta 4/5) the events end when the first finger goes away. I think this is the right response if you are looking for pinch/zoom gestures.
Here is a modified version of MikeHart’s test code. You need to add the build.settings patch to see the Beta 3 Multitouch mode.
-- activate multitouch
system.activate( "multitouch" )
local tPrevious= 0
local touchCnt = 0 -- total number of touches
txtfps = display.newText( "fps:99", 240, 20, "Verdana-Bold", 16 )
txtfps:setTextColor( 255,255,255 )
txtTouch = display.newText( "cTouches: 99", 40, 20, "Verdana-Bold", 16 )
txtTouch:setTextColor( 255,255,255 )
txtTouch:setReferencePoint(display.TopLeftReferencePoint)
--txtTouch.text = " ctouches: "..0
txtTouchp = display.newText( " ptouches: 99", 40, 60, "Verdana-Bold", 16 )
txtTouchp:setTextColor( 255,255,255 )
txtTouchp.text = " ptouches: "..0
txtTouchc = display.newText( "touch cnt: 0", 40, 100, "Verdana-Bold", 16 )
txtTouchc:setTextColor( 255,255,255 )
txtTouchType = display.newText( "previousTouch Type: nil", 45, 400, "Verdana-Bold", 16 )
txtTouchType:setTextColor( 255,255,255 )
txtTouchPhase = display.newText( "touch Phase: begin", 45, 440, "Verdana-Bold", 16 )
txtTouchPhase:setTextColor( 255,255,255 )
txtTouchID = display.newText( "touch ID: 999999", 50, 360, "Verdana-Bold", 16 )
txtTouchID:setTextColor( 255,255,255 )
local finish = function(target)
target.parent:remove( target )
end
-- create a table listener object for the bkgd image
function onTouch( event )
--local result = true
--local phase = event.phase
--print (event.phase)
-- when multitouch is active, the event will contain an array of
-- all touch events that have changed since the last touch event
-- these should all share the same phase
local touches = event.touches
-- when multitouch is active, the event will contain an array of
-- all touches that are still touching the screen from previous events
local previousTouches = event.previousTouches
touchCnt = touchCnt + 1
print("txtTouch.x = " .. txtTouch.x .. ", txtTouch.y = " .. txtTouch.y) -- \*\*debug
txtTouch.text = "ctouches: " .. tostring(type(touches) ~= "nil" and #touches)
print("txtTouch.x = " .. txtTouch.x .. ", txtTouch.y = " .. txtTouch.y) -- \*\*debug
txtTouchp.text = "ptouches: " .. tostring(type(previousTouches) ~= "nil" and #previousTouches)
txtTouchc.text = "touch cnt: " .. touchCnt
txtTouchType.text = "previousTouches Type: " .. type(event.previousTouches)
txtTouchPhase.text = "touch Phase: " .. event.phase
txtTouchID.text = "touch ID: " .. tostring(event.id)
end
local onFrame = function(event)
local tDelta = event.time - tPrevious
tPrevious = event.time
txtfps.text = "fps: "..tDelta
collectgarbage("collect")
end
-- register table listener
Runtime:addEventListener( "touch", onTouch )
Runtime:addEventListener( "enterFrame", onFrame )
Some of the comments may not be correct for the Beta 3 Multitouch mode.
Tom [import]uid: 6119 topic_id: 1128 reply_id: 3139[/import]