整理代码,部分只用到一次的DOGC移出TEXTURE模块

This commit is contained in:
MrZ626
2021-05-21 11:18:23 +08:00
parent fa0dc1f946
commit 152aa0406e
4 changed files with 29 additions and 32 deletions

View File

@@ -540,12 +540,12 @@ function love.run()
TASK.update()
WS.update(dt)
VOC.update()
BG.update(dt)--BG animation
BG.update(dt)
SYSFX.update(dt)
WIDGET.update()--Widgets animation
if SCN.update then SCN.update(dt)end--Scene updater
if SCN.swapping then SCN.swapUpdate()end--Scene swapping animation
TEXT.update()--Update global texts animation
WIDGET.update()
if SCN.update then SCN.update(dt)end
if SCN.swapping then SCN.swapUpdate()end
TEXT.update()
LOG.update()
--DRAW

View File

@@ -545,6 +545,19 @@ end
--Game draw
do--function drawSelfProfile()
local lvIcon=setmetatable({},{__index=function(self,lv)
local img={25,25}
ins(img,{"clear",0,0,0})
ins(img,{"setLW",4})
ins(img,{"setCL",.5,.8,1})
ins(img,{"dRect",2,2,21,21})
--TODO: draw with lv
img=DOGC(img)
rawset(self,lv,img)
return img
end})
local name
local textObject,scaleK,width,offY
function drawSelfProfile()
@@ -570,7 +583,7 @@ do--function drawSelfProfile()
gc_draw(textObject,-82,26,nil,scaleK,nil,width,offY)
--Draw lv. & xp.
gc_draw(TEXTURE.lvIcon[USER.lv],-295,50)
gc_draw(lvIcon[USER.lv],-295,50)
gc_line(-270,55,-80,55,-80,70,-270,70)
gc_rectangle('fill',-210,55,150*USER.xp/USER.lv/USER.lv,15)

View File

@@ -172,7 +172,16 @@ scene.widgetList={
WIDGET.newButton{name="manual", x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=pressKey","},
WIDGET.newButton{name="music", x=130,y=80,w=200,h=90, color='lO',font=35,code=pressKey"2"},
WIDGET.newButton{name="lang", x=300,y=80,w=90,h=90, color='lN',font=40,code=pressKey"3",fText=TEXTURE.earth},
WIDGET.newButton{name="lang", x=300,y=80,w=90,h=90, color='lN',font=40,code=pressKey"3",
fText=DOGC{64,64,
{"setLW",4},
{"dCirc",32,32,30},
{"line",2,31,62,31},
{"line",31,2,31,62},
{"dArc",10,31,40,-.8,.8},
{"dArc",53,31,40,2.3,3.9},
}
},
WIDGET.newButton{name="about", x=-110,y=670,w=600,h=70, color='lB',font=35,align='R',edge=30,code=pressKey"x"},
WIDGET.newButton{name="back", x=1390,y=670,w=600,h=70, color='lR',font=40,align='L',edge=30,code=backScene},
}

View File

@@ -65,21 +65,6 @@ for i=0,9 do
}
end
--Level icons
TEXTURE.lvIcon=setmetatable({},{__index=function(self,lv)
local img={25,25}
ins(img,{"clear",0,0,0})
ins(img,{"setLW",4})
ins(img,{"setCL",.5,.8,1})
ins(img,{"dRect",2,2,21,21})
--TODO: draw with lv
img=DOGC(img)
rawset(self,lv,img)
return img
end})
--Setting icon
TEXTURE.setting=DOGC{64,64,
{"setLW",8},
@@ -95,16 +80,6 @@ TEXTURE.setting=DOGC{64,64,
{"line",45,19,55,9},
}
--Earth icon
TEXTURE.earth=DOGC{64,64,
{"setLW",4},
{"dCirc",32,32,30},
{"line",2,31,62,31},
{"line",31,2,31,62},
{"dArc",10,31,40,-.8,.8},
{"dArc",53,31,40,2.3,3.9},
}
gc.setDefaultFilter('linear','linear')