整理代码
This commit is contained in:
@@ -3,21 +3,21 @@ EDITING=""
|
||||
LOADED=false
|
||||
ERRDATA={}
|
||||
|
||||
SCR= require"Zframework.screen"
|
||||
COLOR= require"Zframework.color"
|
||||
SCN= require"Zframework.scene"
|
||||
LOG= require"Zframework.log"
|
||||
WS= require"Zframework.websocket"
|
||||
|
||||
LOADLIB=require"Zframework.loadLib"
|
||||
WHEELMOV=require"Zframework.wheelScroll"
|
||||
|
||||
require"Zframework.setFont"
|
||||
ADRAW=require"Zframework.aDraw"
|
||||
mStr=ADRAW.str
|
||||
mText=ADRAW.simpX
|
||||
mDraw=ADRAW.draw
|
||||
|
||||
SCR= require"Zframework.screen"
|
||||
COLOR= require"Zframework.color"
|
||||
LOG= require"Zframework.log"
|
||||
SCN= require"Zframework.scene"
|
||||
WS= require"Zframework.websocket"
|
||||
|
||||
LOADLIB=require"Zframework.loadLib"
|
||||
WHEELMOV=require"Zframework.wheelScroll"
|
||||
|
||||
JSON=require"Zframework.json"
|
||||
TABLE=require"Zframework.tableExtend"
|
||||
STRING=require"Zframework.stringExtend"
|
||||
@@ -213,12 +213,12 @@ local function noDevkeyPressed(key)
|
||||
elseif key=="f5"then print(WIDGET.isFocus()or"no widget selected")
|
||||
elseif key=="f6"then for k,v in next,_G do print(k,v)end
|
||||
elseif key=="f7"then if love._openConsole then love._openConsole()end
|
||||
elseif key=="f8"then devMode=nil LOG.print("DEBUG OFF")
|
||||
elseif key=="f8"then devMode=nil LOG.print("DEBUG OFF",10)
|
||||
elseif key=="f9"then devMode=1 LOG.print("DEBUG 1")
|
||||
elseif key=="f10"then devMode=2 LOG.print("DEBUG 2")
|
||||
elseif key=="f11"then devMode=3 LOG.print("DEBUG 3")
|
||||
elseif key=="f12"then devMode=4 LOG.print("DEBUG 4")
|
||||
elseif key=="\\"then _G["\100\114\97\119\70\87\77"]=NULL
|
||||
elseif key=="backspace"then if kb.isDown("lctrl","rctrl")then _G["\100\114\97\119\70\87\77"]=NULL end
|
||||
elseif devMode==2 then
|
||||
local W=WIDGET.sel
|
||||
if W then
|
||||
@@ -247,7 +247,7 @@ function love.keypressed(key)
|
||||
return
|
||||
elseif key=="f8"then
|
||||
devMode=1
|
||||
LOG.print("DEBUG ON")
|
||||
LOG.print("DEBUG ON",10)
|
||||
elseif key=="f11"then
|
||||
switchFullscreen()
|
||||
elseif not SCN.swapping then
|
||||
@@ -586,17 +586,21 @@ function love.run()
|
||||
gc_pop()
|
||||
|
||||
--Draw power info.
|
||||
gc_setColor(1,1,1)
|
||||
if SETTING.powerInfo then
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(infoCanvas,SCR.safeX,0,0,SCR.k)
|
||||
end
|
||||
|
||||
--Draw scene swapping animation
|
||||
if SCN.swapping then
|
||||
gc_setColor(1,1,1)
|
||||
_=SCN.stat
|
||||
_.draw(_.time)
|
||||
end
|
||||
|
||||
--Draw Logs
|
||||
LOG.draw()
|
||||
|
||||
--Draw FPS
|
||||
setFont(15)
|
||||
_=SCR.h
|
||||
@@ -650,7 +654,6 @@ function love.run()
|
||||
elseif devMode==4 then WAIT(.5)
|
||||
end
|
||||
end
|
||||
LOG.draw()
|
||||
|
||||
gc_present()
|
||||
|
||||
|
||||
@@ -1,43 +1,45 @@
|
||||
local gc=love.graphics
|
||||
local gc_setColor,gc_print=gc.setColor,gc.print
|
||||
local int,max,min=math.floor,math.max,math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
local SCR,setFont=SCR,setFont
|
||||
|
||||
local debugMesList={}
|
||||
local debugMesHistory={
|
||||
local mesList={}
|
||||
local mesHistory={
|
||||
"Version: "..VERSION.string,
|
||||
os.date("Launched at %Y/%m/%d %H:%M"),
|
||||
}
|
||||
local LOG={}
|
||||
function LOG.update()
|
||||
if debugMesList[1]then
|
||||
for i=#debugMesList,1,-1 do
|
||||
local M=debugMesList[i]
|
||||
if mesList[1]then
|
||||
for i=#mesList,1,-1 do
|
||||
local M=mesList[i]
|
||||
if M.blink>0 then
|
||||
M.blink=M.blink-1
|
||||
else
|
||||
M.time=M.time-1
|
||||
if M.time==0 then
|
||||
rem(debugMesList,i)
|
||||
rem(mesList,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LOG.draw()
|
||||
if debugMesList[1]then
|
||||
if mesList[1]then
|
||||
local k=SCR.w/SCR.w0
|
||||
setFont(max(int(4*k)*5,5))
|
||||
for i=1,#debugMesList do
|
||||
local M=debugMesList[i]
|
||||
local t=M.time
|
||||
gc.setColor(M.r,M.g,M.b,M.blink>0 and int(M.blink/3)%2 or min(t/26,1))
|
||||
gc.print(M.text,10+(20-min(t,20))^1.5/4,25*i*k)
|
||||
for i=1,#mesList do
|
||||
local M=mesList[i]
|
||||
M.rgba[4]=M.blink>0 and int(M.blink/3)%2 or min(M.time/26,1)
|
||||
gc_setColor(M.rgba)
|
||||
gc_print(M.text,10+(20-min(M.time,20))^1.5/4,25*i*k)
|
||||
end
|
||||
end
|
||||
end
|
||||
function LOG.print(text,T)--text,type/time/color,color
|
||||
local color=COLOR.Z
|
||||
local time,his
|
||||
local his,time
|
||||
if T=='message'then
|
||||
color=COLOR.N
|
||||
his,time=true,180
|
||||
@@ -50,11 +52,11 @@ function LOG.print(text,T)--text,type/time/color,color
|
||||
elseif type(T)=='number'then
|
||||
time=T
|
||||
end
|
||||
if his then ins(debugMesHistory,SCN.cur..": "..tostring(text))end
|
||||
ins(debugMesList,{text=tostring(text),r=color[1],g=color[2],b=color[3],blink=30,time=time or 120})
|
||||
if his then ins(mesHistory,SCN.cur..": "..tostring(text))end
|
||||
ins(mesList,{text=tostring(text),rgba={color[1],color[2],color[3],nil},blink=30,time=time or 120})
|
||||
end
|
||||
function LOG.copy()
|
||||
love.system.setClipboardText(table.concat(debugMesHistory,"\n"))
|
||||
love.system.setClipboardText(table.concat(mesHistory,"\n"))
|
||||
LOG.print("Log copied",'message')
|
||||
end
|
||||
return LOG
|
||||
Reference in New Issue
Block a user