From 013765d5d2707b1a231589369aa3f88bef89a8d7 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 18 Oct 2021 23:45:03 +0800 Subject: [PATCH] =?UTF-8?q?touching=E5=8F=98=E9=87=8F=E7=A7=BB=E5=85=A5SCN?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=20=E4=BF=AE=E5=A4=8DiOS=E4=B8=8A=E7=BB=8F?= =?UTF-8?q?=E5=B8=B8=E5=8D=A1=E6=8E=89=E7=AC=AC=E4=B8=80=E4=B8=AA=E8=A7=A6?= =?UTF-8?q?=E6=91=B8=E5=AF=BC=E8=87=B4=E5=90=8E=E7=BB=AD=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=92=8C=E6=8E=A7=E4=BB=B6=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 9 ++++----- Zframework/scene.lua | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 8a978e1b..168bb3dc 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -71,7 +71,6 @@ local xOy=SCR.xOy local ITP=xOy.inverseTransformPoint local mx,my,mouseShow=-20,-20,false -local touching--First touching ID(userdata) joysticks={} local devMode @@ -181,8 +180,8 @@ end function love.touchpressed(id,x,y) mouseShow=false if SCN.swapping then return end - if not touching then - touching=id + if not SCN.mainTouchID then + SCN.mainTouchID=id WIDGET.unFocus(true) love.touchmoved(id,x,y,0,0) end @@ -201,12 +200,12 @@ end function love.touchreleased(id,x,y) if SCN.swapping then return end x,y=ITP(xOy,x,y) - if id==touching then + if id==SCN.mainTouchID then WIDGET.press(x,y,1) WIDGET.release(x,y) WIDGET.cursorMove(x,y) WIDGET.unFocus() - touching=false + SCN.mainTouchID=false end if SCN.touchUp then SCN.touchUp(x,y)end if(x-lastX)^2+(y-lastY)^2<62 then diff --git a/Zframework/scene.lua b/Zframework/scene.lua index d7d2a873..da06ce44 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -4,6 +4,7 @@ local abs=math.abs local scenes={} local SCN={ + mainTouchID=nil, --First touching ID(userdata) cur='NULL', --Current scene name swapping=false, --If Swapping stat={ @@ -52,6 +53,7 @@ function SCN.swapUpdate(dt) if S.time=S.changeTime then --Scene swapped this frame SCN.init(S.tar,SCN.cur) + SCN.mainTouchID=nil end if S.time<0 then SCN.swapping=false