简化场景touch事件参数

This commit is contained in:
MrZ626
2021-02-10 20:08:10 +08:00
parent d2a524b26e
commit 1b5401bf7f
16 changed files with 31 additions and 31 deletions

View File

@@ -132,13 +132,13 @@ function love.touchpressed(id,x,y)
end
x,y=xOy:inverseTransformPoint(x,y)
lastX,lastY=x,y
if SCN.touchDown then SCN.touchDown(id,x,y)end
if SCN.touchDown then SCN.touchDown(x,y)end
if kb.hasTextInput()then kb.setTextInput(false)end
end
function love.touchmoved(id,x,y,dx,dy)
if SCN.swapping then return end
x,y=xOy:inverseTransformPoint(x,y)
if SCN.touchMove then SCN.touchMove(id,x,y,dx/SCR.k,dy/SCR.k)end
if SCN.touchMove then SCN.touchMove(x,y,dx/SCR.k,dy/SCR.k)end
if WIDGET.sel then
if touching then
WIDGET.drag(x,y,dx,dy)
@@ -161,7 +161,7 @@ function love.touchreleased(id,x,y)
WIDGET.sel=false
end
end
if SCN.touchUp then SCN.touchUp(id,x,y)end
if SCN.touchUp then SCN.touchUp(x,y)end
if(x-lastX)^2+(y-lastY)^2<26 then
if SCN.touchClick then SCN.touchClick(x,y)end
SYSFX.newTap(3,x,y,30)

View File

@@ -50,10 +50,10 @@ function scene.wheelMoved(_,y)
if pen==0 then pen=24 end
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseMove(x,y)
end
function scene.touchMove(_,x,y)
function scene.touchMove(x,y)
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=nil end
if sy<1 or sy>20 then sy=nil end

View File

@@ -183,10 +183,10 @@ function scene.mouseMove(x,y)
tapBoard(x,y)
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
tapBoard(x,y)
end
function scene.touchMove(_,x,y)
function scene.touchMove(x,y)
if slide then
tapBoard(x,y)
end

View File

@@ -250,7 +250,7 @@ function scene.mouseDown(x,y,k)
end
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseDown(x,y)
end
local moveFunc={

View File

@@ -202,15 +202,15 @@ function scene.draw()
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseMove(x,y)
end
function scene.touchMove(_,x,y)
function scene.touchMove(x,y)
scene.mouseMove(x,y)
end
function scene.touchUp(_,x,y)
function scene.touchUp(x,y)
scene.mouseDown(x,y)
end

View File

@@ -66,7 +66,7 @@ function scene.sceneInit()
BG.set("none")
end
function scene.touchDown(_,x)
function scene.touchDown(x)
if play then
if x<640 then
moveDir=-1
@@ -75,7 +75,7 @@ function scene.touchDown(_,x)
end
end
end
function scene.touchUp(_,x)
function scene.touchUp(x)
if play then
local L=tc.getTouches()
if x<640 then

View File

@@ -147,13 +147,13 @@ function scene.mouseDown(x,y)
merge()
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseMove(x,y)
end
function scene.touchMove(_,x,y)
function scene.touchMove(x,y)
scene.mouseMove(x,y)
end
function scene.touchClick(_,x,y)
function scene.touchClick(x,y)
scene.mouseDown(x,y)
end

View File

@@ -61,11 +61,11 @@ function scene.keyDown(key)
SCN.back()
end
end
function scene.touchDown(id,x,y)
scene.touchMove(id,x,y)
function scene.touchDown(x,y)
scene.touchMove(x,y)
if state==0 then start()end
end
function scene.touchMove(_,x,y)(x<640 and p1 or p2).y0=y end
function scene.touchMove(x,y)(x<640 and p1 or p2).y0=y end
function scene.mouseMove(x,y)(x<640 and p1 or p2).y0=y end
--Rect Area X:150~1130 Y:20~700

View File

@@ -77,7 +77,7 @@ end
function scene.mouseDown(x,y)
tapBoard(x,y)
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
tapBoard(x,y)
end
function scene.keyDown(key)

View File

@@ -65,10 +65,10 @@ function scene.mouseDown(x,y,k)
end
end
end
function scene.touchMove(_,x,y)
function scene.touchMove(x,y)
scene.mouseMove(x,y)
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseMove(x,y)
scene.mouseDown(x,y)
end

View File

@@ -93,7 +93,7 @@ end
function scene.touchDown()
touchDist=false
end
function scene.touchMove(_,x,y,dx,dy)
function scene.touchMove(x,y,dx,dy)
local L=tc.getTouches()
if not L[2]then
moveMap(dx,dy)

View File

@@ -52,7 +52,7 @@ function scene.sceneInit()
heartBeatTimer=0
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
if noTouch then return end
local t=onVirtualkey(x,y)
@@ -61,7 +61,7 @@ function scene.touchDown(_,x,y)
pressVirtualkey(t,x,y)
end
end
function scene.touchUp(_,x,y)
function scene.touchUp(x,y)
if noTouch then return end
local t=onVirtualkey(x,y)

View File

@@ -30,7 +30,7 @@ local function restart()
resetGameData(GAME.frame<240 and"q")
noKey=GAME.replaying
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
if noTouch then return end
local t=onVirtualkey(x,y)
@@ -39,7 +39,7 @@ function scene.touchDown(_,x,y)
pressVirtualkey(t,x,y)
end
end
function scene.touchUp(_,x,y)
function scene.touchUp(x,y)
if noTouch then return end
local t=onVirtualkey(x,y)

View File

@@ -29,7 +29,7 @@ function scene.mouseDown(x,y)
end
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseDown(x,y)
end

View File

@@ -50,7 +50,7 @@ function scene.mouseUp()
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
selected=onVK_org(x,y)or selected
end
function scene.touchUp()
@@ -60,7 +60,7 @@ function scene.touchUp()
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function scene.touchMove(_,_,_,dx,dy)
function scene.touchMove(_,_,dx,dy)
if selected and not WIDGET.sel then
local B=VK_org[selected]
B.x,B.y=B.x+dx,B.y+dy

View File

@@ -22,7 +22,7 @@ function scene.mouseDown(x,y)
end
end
function scene.touchDown(_,x,y)
function scene.touchDown(x,y)
scene.mouseDown(x,y)
end