类型 函数 库 system.* 返回值 无 修订 版本 2024.3703 关键词 多点触控 另请参阅 system.deactivate()
激活系统级功能,例如 "multitouch"(多点触控)。类似地,您可以使用 system.deactivate() 禁用某个功能。
默认情况下,多点触控功能是禁用的,因此您必须始终通过此方法首先将其激活。
system.activate( feature )
字符串. 要激活的系统功能。目前,唯一支持的值包括:
"multitouch" — 有关更多信息,请参阅点击/触摸/多点触控指南。"controllerUserInteraction" — 有关更多信息,请参阅Apple TV / tvOS指南。-- The following sample activates multitouch and creates a touch listener for a graphic
-- This displays the location, phase, and touch ID of each touch event
system.activate( "multitouch" )
local bg = display.newRect( 0, 0, 320, 480 )
local output = native.newTextBox( 0, 20, 320, 240 )
output.size = 12
local function showTouch( event )
-- Display the event info on the screen
output.text = output.text .. "\nPhase: " .. event.phase
output.text = output.text .. "\n(" .. event.x .. "," .. event.y .. ")"
output.text = output.text .. "\nId: " .. tostring( event.id )
end
bg:addEventListener( "touch", showTouch )