触屏限制每帧采样两次
This commit is contained in:
@@ -23,7 +23,8 @@ local function onVirtualkey(x,y)
|
|||||||
return nearest
|
return nearest
|
||||||
end
|
end
|
||||||
|
|
||||||
local noTouch,noKey
|
local noTouch,noKey=false,false
|
||||||
|
local touchMoveLastFrame=0
|
||||||
|
|
||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
@@ -81,6 +82,9 @@ function scene.touchUp(_,x,y)
|
|||||||
end
|
end
|
||||||
function scene.touchMove()
|
function scene.touchMove()
|
||||||
if noTouch then return end
|
if noTouch then return end
|
||||||
|
if touchMoveLastFrame>1 then return end
|
||||||
|
touchMoveLastFrame=touchMoveLastFrame+1
|
||||||
|
|
||||||
local L=tc.getTouches()
|
local L=tc.getTouches()
|
||||||
for i=#L,1,-1 do
|
for i=#L,1,-1 do
|
||||||
L[2*i-1],L[2*i]=SCR.xOy:inverseTransformPoint(tc.getPosition(L[i]))
|
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
|
local GAME=GAME
|
||||||
GAME.frame=GAME.frame+1
|
GAME.frame=GAME.frame+1
|
||||||
|
|
||||||
|
touchMoveLastFrame=0
|
||||||
|
|
||||||
--Update virtualkey animation
|
--Update virtualkey animation
|
||||||
if SETTING.VKSwitch then
|
if SETTING.VKSwitch then
|
||||||
for i=1,#VK do
|
for i=1,#VK do
|
||||||
|
|||||||
Reference in New Issue
Block a user