触屏限制每帧采样两次

This commit is contained in:
MrZ626
2020-12-29 00:24:34 +08:00
parent 87e23f3e88
commit c7dc7088c4

View File

@@ -23,7 +23,8 @@ local function onVirtualkey(x,y)
return nearest
end
local noTouch,noKey
local noTouch,noKey=false,false
local touchMoveLastFrame=0
local scene={}
@@ -81,6 +82,9 @@ function scene.touchUp(_,x,y)
end
function scene.touchMove()
if noTouch then return end
if touchMoveLastFrame>1 then return end
touchMoveLastFrame=touchMoveLastFrame+1
local L=tc.getTouches()
for i=#L,1,-1 do
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
@@ -157,6 +161,8 @@ function scene.update(dt)
local GAME=GAME
GAME.frame=GAME.frame+1
touchMoveLastFrame=0
--Update virtualkey animation
if SETTING.VKSwitch then
for i=1,#VK do