整理代码,test场景可以退出了

This commit is contained in:
MrZ626
2021-06-08 06:18:28 +08:00
parent 6428cb39a5
commit 83f037b704
5 changed files with 15 additions and 4 deletions

View File

@@ -524,7 +524,6 @@ function love.run()
local TEXTURE,TIME=TEXTURE,TIME
local SETTING,VERSION=SETTING,VERSION
local destroyPlayers=destroyPlayers
local STEP,WAIT=love.timer.step,love.timer.sleep
local FPS,MINI=love.timer.getFPS,love.window.isMinimized

View File

@@ -16,6 +16,10 @@ function scene.sceneInit()
noKey=GAME.replaying
noTouch=not SETTING.VKSwitch or noKey
end
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
destroyPlayers()
end
scene.mouseDown=NULL
local function restart()

View File

@@ -29,7 +29,6 @@ local scene={}
function scene.sceneInit(org)
BG.set()
destroyPlayers()
mapCam.zoomK=org=='main'and 5 or 1
end

View File

@@ -219,7 +219,6 @@ function scene.socketRead(cmd,d)
end
elseif cmd=='finish'then
playing=false
love.keyboard.setKeyRepeat(true)
end
end

View File

@@ -3,6 +3,7 @@ local ins,rem=table.insert,table.remove
local scene={}
local backCounter
local list,timer
local function push(mes)
ins(list,{mes,120})
@@ -10,13 +11,14 @@ local function push(mes)
end
function scene.sceneInit()
backCounter=5
list={}
timer=0
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
list=nil
list={}
love.keyboard.setKeyRepeat(true)
end
@@ -28,6 +30,14 @@ function scene.gamepadUp(key)
end
function scene.keyDown(key)
push("[keyDown] <"..key..">")
if key=="escape"then
backCounter=backCounter-1
if backCounter==0 then
SCN.back()
else
LOG.print(backCounter)
end
end
end
function scene.keyUp(key)
push{COLOR.H,"[keyUp] <"..key..">"}