整理代码习惯,常量字符串改用单引号,可能有遗漏
This commit is contained in:
@@ -66,12 +66,12 @@ local devMode
|
||||
local infoCanvas=gc.newCanvas(108,27)
|
||||
local function updatePowerInfo()
|
||||
local state,pow=love.system.getPowerInfo()
|
||||
gc.setCanvas(infoCanvas)gc_push("transform")gc.origin()
|
||||
gc.setCanvas(infoCanvas)gc_push('transform')gc.origin()
|
||||
gc.clear(0,0,0,.25)
|
||||
if state~="unknown"then
|
||||
if state~='unknown'then
|
||||
gc.setLineWidth(4)
|
||||
local charging=state=="charging"
|
||||
if state=="nobattery"then
|
||||
local charging=state=='charging'
|
||||
if state=='nobattery'then
|
||||
gc_setColor(1,1,1)
|
||||
gc.setLineWidth(2)
|
||||
gc.line(74,SCR.safeX+5,100,22)
|
||||
@@ -82,7 +82,7 @@ local function updatePowerInfo()
|
||||
elseif pow<26 then gc_setColor(1,0,0)
|
||||
else gc_setColor(.5,0,1)
|
||||
end
|
||||
gc_rectangle("fill",76,6,pow*.22,14)
|
||||
gc_rectangle('fill',76,6,pow*.22,14)
|
||||
if pow<100 then
|
||||
setFont(15)
|
||||
gc_setColor(0,0,0)
|
||||
@@ -281,12 +281,12 @@ function love.joystickremoved(JS)
|
||||
end
|
||||
end
|
||||
local keyMirror={
|
||||
dpup="up",
|
||||
dpdown="down",
|
||||
dpleft="left",
|
||||
dpright="right",
|
||||
start="return",
|
||||
back="escape",
|
||||
dpup='up',
|
||||
dpdown='down',
|
||||
dpleft='left',
|
||||
dpright='right',
|
||||
start='return',
|
||||
back='escape',
|
||||
}
|
||||
function love.gamepadpressed(_,i)
|
||||
mouseShow=false
|
||||
@@ -330,7 +330,7 @@ function love.lowmemory()
|
||||
if TIME()-lastGCtime>6.26 then
|
||||
collectgarbage()
|
||||
lastGCtime=TIME()
|
||||
LOG.print("[auto GC] low MEM 设备内存过低","warn")
|
||||
LOG.print("[auto GC] low MEM 设备内存过低",'warn')
|
||||
end
|
||||
end
|
||||
function love.resize(w,h)
|
||||
@@ -343,7 +343,7 @@ end
|
||||
function love.focus(f)
|
||||
if f then
|
||||
love.timer.step()
|
||||
elseif SCN.cur=="game"and SETTING.autoPause then
|
||||
elseif SCN.cur=='game'and SETTING.autoPause then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
@@ -377,7 +377,7 @@ function love.errorhandler(msg)
|
||||
gc.reset()
|
||||
|
||||
if LOADED and #ERRDATA<3 then
|
||||
BG.set("none")
|
||||
BG.set('none')
|
||||
local scn=SCN and SCN.cur or"NULL"
|
||||
ERRDATA[#ERRDATA+1]={mes=err,scene=scn}
|
||||
|
||||
@@ -398,7 +398,7 @@ function love.errorhandler(msg)
|
||||
local res,threadErr
|
||||
repeat
|
||||
res,threadErr=resume(loopThread)
|
||||
until status(loopThread)=="dead"
|
||||
until status(loopThread)=='dead'
|
||||
if not res then
|
||||
love.errorhandler(threadErr)
|
||||
return
|
||||
@@ -413,15 +413,15 @@ function love.errorhandler(msg)
|
||||
while true do
|
||||
love.event.pump()
|
||||
for E,a,b in love.event.poll()do
|
||||
if E=="quit"or a=="escape"then
|
||||
if E=='quit'or a=='escape'then
|
||||
destroyPlayers()
|
||||
return true
|
||||
elseif E=="resize"then
|
||||
elseif E=='resize'then
|
||||
SCR.resize(a,b)
|
||||
end
|
||||
end
|
||||
gc.clear(.3,.5,.9)
|
||||
gc_push("transform")
|
||||
gc_push('transform')
|
||||
gc.replaceTransform(xOy)
|
||||
setFont(100)gc_print(":(",100,0,0,1.2)
|
||||
setFont(40)gc.printf(errorMsg,100,160,SCR.w0-100)
|
||||
@@ -439,7 +439,7 @@ function love.errorhandler(msg)
|
||||
end
|
||||
end
|
||||
local WS=WS
|
||||
local WSnames={"app","user","play","stream","chat"}
|
||||
local WSnames={'app','user','play','stream','chat'}
|
||||
local WScolor={
|
||||
{1,.5,.5,.7},
|
||||
{1,.8,.3,.7},
|
||||
@@ -479,8 +479,8 @@ function love.run()
|
||||
|
||||
--Scene Launch
|
||||
while #SCN.stack>0 do SCN.pop()end
|
||||
SCN.push("quit","slowFade")
|
||||
SCN.init(#ERRDATA==0 and"load"or"error")
|
||||
SCN.push('quit','slowFade')
|
||||
SCN.init(#ERRDATA==0 and'load'or'error')
|
||||
|
||||
return function()
|
||||
local _
|
||||
@@ -494,7 +494,7 @@ function love.run()
|
||||
for N,a,b,c,d,e in POLL()do
|
||||
if love[N]then
|
||||
love[N](a,b,c,d,e)
|
||||
elseif N=="quit"then
|
||||
elseif N=='quit'then
|
||||
destroyPlayers()
|
||||
return a or true
|
||||
end
|
||||
@@ -522,7 +522,7 @@ function love.run()
|
||||
--Draw background
|
||||
BG.draw()
|
||||
|
||||
gc_push("transform")
|
||||
gc_push('transform')
|
||||
gc.replaceTransform(xOy)
|
||||
|
||||
--Draw scene contents
|
||||
@@ -539,7 +539,7 @@ function love.run()
|
||||
_=SCS[R][0]
|
||||
gc_draw(TEXTURE.miniBlock[R],mx,my,t%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5)
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(TEXTURE[ms.isDown(1)and"cursor_hold"or"cursor"],mx,my,nil,nil,nil,8,8)
|
||||
gc_draw(TEXTURE[ms.isDown(1)and'cursor_hold'or'cursor'],mx,my,nil,nil,nil,8,8)
|
||||
end
|
||||
SYSFX.draw()
|
||||
TEXT.draw()
|
||||
@@ -577,31 +577,31 @@ function love.run()
|
||||
ins(frameTimeList,1,dt)rem(frameTimeList,126)
|
||||
gc_setColor(1,1,1,.3)
|
||||
for i=1,#frameTimeList do
|
||||
gc_rectangle("fill",150+2*i,_-20,2,-frameTimeList[i]*4000)
|
||||
gc_rectangle('fill',150+2*i,_-20,2,-frameTimeList[i]*4000)
|
||||
end
|
||||
|
||||
--Websocket status
|
||||
gc_push("transform")
|
||||
gc_push('transform')
|
||||
gc.translate(SCR.w,SCR.h-100)
|
||||
gc.scale(SCR.k)
|
||||
for i=1,5 do
|
||||
local status=WS.status(WSnames[i])
|
||||
gc_setColor(WScolor[i])
|
||||
gc_rectangle("fill",0,20*i,-80,-20)
|
||||
if status=="dead"then
|
||||
gc_rectangle('fill',0,20*i,-80,-20)
|
||||
if status=='dead'then
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(TEXTURE.ws_dead,-20,20*i-20)
|
||||
elseif status=="connecting"then
|
||||
elseif status=='connecting'then
|
||||
gc_setColor(1,1,1,.5+.3*sin(t*6.26))
|
||||
gc_draw(TEXTURE.ws_connecting,-20,20*i-20)
|
||||
elseif status=="running"then
|
||||
elseif status=='running'then
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(TEXTURE.ws_running,-20,20*i-20)
|
||||
end
|
||||
local t1,t2,t3=WS.getTimers(WSnames[i])
|
||||
gc_setColor(1,1,1,t1)gc_rectangle("fill",-60,20*i,-20,-20)
|
||||
gc_setColor(0,1,0,t2)gc_rectangle("fill",-40,20*i,-20,-20)
|
||||
gc_setColor(1,0,0,t3)gc_rectangle("fill",-20,20*i,-20,-20)
|
||||
gc_setColor(1,1,1,t1)gc_rectangle('fill',-60,20*i,-20,-20)
|
||||
gc_setColor(0,1,0,t2)gc_rectangle('fill',-40,20*i,-20,-20)
|
||||
gc_setColor(1,0,0,t3)gc_rectangle('fill',-20,20*i,-20,-20)
|
||||
end
|
||||
gc_pop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user