整理代码,关闭大量小程序的按键自动重复

This commit is contained in:
MrZ626
2021-03-11 18:33:57 +08:00
parent 2ebf8f5941
commit 974f2b823c
9 changed files with 28 additions and 4 deletions

View File

@@ -231,6 +231,10 @@ function scene.sceneInit()
tapControl=false tapControl=false
startTime=0 startTime=0
reset() reset()
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
function scene.mouseDown(x,y,k) function scene.mouseDown(x,y,k)

View File

@@ -18,6 +18,10 @@ function scene.sceneInit()
ex,ey=626,260 ex,ey=626,260
BG.set("matrix") BG.set("matrix")
BGM.play("way") BGM.play("way")
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
function scene.keyDown(key) function scene.keyDown(key)

View File

@@ -64,6 +64,10 @@ function scene.sceneInit()
gc.setLineJoin("bevel") gc.setLineJoin("bevel")
BGM.play("push") BGM.play("push")
BG.set("none") BG.set("none")
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
function scene.touchDown(x) function scene.touchDown(x)

View File

@@ -34,6 +34,10 @@ function scene.sceneInit()
state="menu" state="menu"
BGM.play("new era") BGM.play("new era")
BG.set("space") BG.set("space")
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
function scene.keyDown(key) function scene.keyDown(key)
@@ -239,7 +243,7 @@ function scene.draw()
end end
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="back",x=1140,y=60,w=170,h=80,font=40,code=pressKey("escape")}, WIDGET.newButton{name="back",x=1140,y=60,w=170,h=80,font=40,code=pressKey"escape"},
} }
return scene return scene

View File

@@ -87,6 +87,10 @@ function scene.sceneInit()
reset() reset()
BG.set("grey") BG.set("grey")
BGM.play("way") BGM.play("way")
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
local function touch(n) local function touch(n)

View File

@@ -17,6 +17,10 @@ end
function scene.sceneInit() function scene.sceneInit()
reset() reset()
BG.set("none") BG.set("none")
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end end
function scene.keyDown(key) function scene.keyDown(key)

View File

@@ -13,9 +13,9 @@ function scene.sceneInit()
lastKey=nil lastKey=nil
speed=0 speed=0
keyTime={}for i=1,40 do keyTime[i]=-1e99 end keyTime={}for i=1,40 do keyTime[i]=-1e99 end
love.keyboard.setKeyRepeat(false)
BG.set("grey") BG.set("grey")
BGM.play("push") BGM.play("push")
love.keyboard.setKeyRepeat(false)
end end
function scene.sceneBack() function scene.sceneBack()
love.keyboard.setKeyRepeat(true) love.keyboard.setKeyRepeat(true)

View File

@@ -323,7 +323,7 @@ function scene.draw()
end end
scene.widgetList={ scene.widgetList={
textBox, textBox,
WIDGET.newKey{name="ready",x=640,y=440,w=200,h=80,color="yellow",font=40,code=pressKey("space"),hide=function()return playing or not hideChatBox or PLAYERS[1].ready end}, WIDGET.newKey{name="ready",x=640,y=440,w=200,h=80,color="yellow",font=40,code=pressKey"space",hide=function()return playing or not hideChatBox or PLAYERS[1].ready end},
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=switchChat}, WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=switchChat},
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"}, WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=pressKey"escape"},
} }

View File

@@ -126,7 +126,7 @@ end
scene.widgetList={ scene.widgetList={
WIDGET.newKey{name="fresh", x=240,y=620,w=140,h=140,font=40,code=fresh,hide=function()return TIME()-lastfreshTime<1.26 end}, WIDGET.newKey{name="fresh", x=240,y=620,w=140,h=140,font=40,code=fresh,hide=function()return TIME()-lastfreshTime<1.26 end},
WIDGET.newKey{name="new", x=440,y=620,w=140,h=140,font=25,code=pressKey("n")}, WIDGET.newKey{name="new", x=440,y=620,w=140,h=140,font=25,code=pressKey"n"},
WIDGET.newKey{name="join", x=640,y=620,w=140,h=140,font=40,code=pressKey"return",hide=function()return not rooms end}, WIDGET.newKey{name="join", x=640,y=620,w=140,h=140,font=40,code=pressKey"return",hide=function()return not rooms end},
WIDGET.newKey{name="up", x=840,y=585,w=140,h=70,font=40,code=pressKey"up",hide=function()return not rooms end}, WIDGET.newKey{name="up", x=840,y=585,w=140,h=70,font=40,code=pressKey"up",hide=function()return not rooms end},
WIDGET.newKey{name="down", x=840,y=655,w=140,h=70,font=40,code=pressKey"down",hide=function()return not rooms end}, WIDGET.newKey{name="down", x=840,y=655,w=140,h=70,font=40,code=pressKey"down",hide=function()return not rooms end},