整理代码

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 BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
local needDraw=true local needDraw=true
local count=0 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() return function()
love.event.pump() love.event.pump()
for E,a,b in love.event.poll()do for E,a,b in love.event.poll()do
@@ -415,7 +416,7 @@ function love.errorhandler(msg)
gc.replaceTransform(xOy) gc.replaceTransform(xOy)
gc_draw(errScrShot,100,365,nil,512/errScrShot:getWidth(),288/errScrShot:getHeight()) gc_draw(errScrShot,100,365,nil,512/errScrShot:getWidth(),288/errScrShot:getHeight())
setFont(100)gc_print(":(",100,40,0,1.2) 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) setFont(20)
gc_print(SYSTEM.."-"..VERSION_NAME,100,660) gc_print(SYSTEM.."-"..VERSION_NAME,100,660)
gc_print("scene:"..SCN.cur,400,660) gc_print("scene:"..SCN.cur,400,660)

View File

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

View File

@@ -54,6 +54,7 @@ THEME=(
false false
) )
--System setting
math.randomseed(os.time()*626) math.randomseed(os.time()*626)
love.keyboard.setKeyRepeat(true) love.keyboard.setKeyRepeat(true)
love.keyboard.setTextInput(false) love.keyboard.setTextInput(false)
@@ -204,6 +205,7 @@ SKIN.init{
"coloredbone_mrz", "coloredbone_mrz",
"wtf", "wtf",
} }
--Initialize sound libs --Initialize sound libs
SFX.init((function() SFX.init((function()
local L={} local L={}
@@ -236,6 +238,7 @@ VOC.init{
"test","happy","doubt","sad","egg", "test","happy","doubt","sad","egg",
"welcome_voc", "welcome_voc",
} }
--Initialize language lib --Initialize language lib
LANG.init( LANG.init(
{ {
@@ -295,7 +298,6 @@ for _,v in next,fs.getDirectoryItems("parts/scenes")do
LOG.print("Dangerous file : %SAVE%/parts/scenes/"..v) LOG.print("Dangerous file : %SAVE%/parts/scenes/"..v)
end end
end end
LANG.set(SETTING.lang) LANG.set(SETTING.lang)
--Update data --Update data

View File

@@ -1,11 +1,3 @@
--[[
HighestBlock
BlockedCells
Wells
FilledLines
4deepShape
BlockedWells
]]
local int,ceil,min,abs,rnd,modf=math.floor,math.ceil,math.min,math.abs,math.random,math.modf local int,ceil,min,abs,rnd,modf=math.floor,math.ceil,math.min,math.abs,math.random,math.modf
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local YIELD=YIELD local YIELD=YIELD
@@ -92,6 +84,14 @@ if _CC then
end end
end end
-------------------------------------------------9 Stack setup -------------------------------------------------9 Stack setup
--[[Future:
HighestBlock
BlockedCells
Wells
FilledLines
4deepShape
BlockedWells
]]
local dirCount={1,1,3,3,3,0,1} local dirCount={1,1,3,3,3,0,1}
local FCL={ local FCL={
[1]={ [1]={