整理代码

This commit is contained in:
MrZ626
2021-03-10 02:01:52 +08:00
parent 7fdc5729d2
commit 5694316eac
4 changed files with 19 additions and 28 deletions

View File

@@ -380,6 +380,7 @@ function love.errorhandler(msg)
local BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
local needDraw=true
local count=0
local errorMsg=text.errorMsg or"An error has occurred and Techmino needs to restart.\nError info has been created, and you can send it to the author."
return function()
love.event.pump()
for E,a,b in love.event.poll()do
@@ -415,7 +416,7 @@ function love.errorhandler(msg)
gc.replaceTransform(xOy)
gc_draw(errScrShot,100,365,nil,512/errScrShot:getWidth(),288/errScrShot:getHeight())
setFont(100)gc_print(":(",100,40,0,1.2)
setFont(40)gc_printf(text.errorMsg,100,200,SCR.w0-100)
setFont(40)gc_printf(errorMsg,100,200,SCR.w0-100)
setFont(20)
gc_print(SYSTEM.."-"..VERSION_NAME,100,660)
gc_print("scene:"..SCN.cur,400,660)

View File

@@ -1,22 +1,10 @@
local printf=love.graphics.printf
local draw=love.graphics.draw
local mDraw={}
function mDraw.str(str,x,y)
printf(str,x-626,y,1252,"center")
end
function mDraw.simpX(str,x,y)
draw(str,x-str:getWidth()*.5,y)
end
function mDraw.simpY(str,x,y)
draw(str,x,y-str:getHeight()*.5)
end
function mDraw.X(str,x,y,a,k)
draw(str,x,y,a,k,nil,str:getWidth()*.5,0)
end
function mDraw.Y(str,x,y,a,k)
draw(str,x,y,a,k,nil,0,str:getHeight()*.5)
end
function mDraw.draw(str,x,y,a,k)
draw(str,x,y,a,k,nil,str:getWidth()*.5,str:getHeight()*.5)
end
function mDraw.str(str,x,y)printf(str,x-626,y,1252,"center")end
function mDraw.simpX(str,x,y)draw(str,x-str:getWidth()*.5,y)end
function mDraw.simpY(str,x,y)draw(str,x,y-str:getHeight()*.5)end
function mDraw.X(str,x,y,a,k)draw(str,x,y,a,k,nil,str:getWidth()*.5,0)end
function mDraw.Y(str,x,y,a,k)draw(str,x,y,a,k,nil,0,str:getHeight()*.5)end
function mDraw.draw(str,x,y,a,k)draw(str,x,y,a,k,nil,str:getWidth()*.5,str:getHeight()*.5)end
return mDraw