整理代码

This commit is contained in:
MrZ626
2021-10-24 00:48:51 +08:00
parent 30093f9db5
commit fd563b732c
3 changed files with 8 additions and 8 deletions

View File

@@ -25,8 +25,8 @@ function FONT.reset()
end end
end end
function FONT.init(mainFont,secFont) function FONT.load(mainFont,secFont)
assert(love.filesystem.getInfo(mainFont)) assert(love.filesystem.getInfo(mainFont),"Font file '"..mainFont.."' not exist!")
mainFont=love.filesystem.newFile(mainFont) mainFont=love.filesystem.newFile(mainFont)
if secFont and love.filesystem.getInfo(secFont)then if secFont and love.filesystem.getInfo(secFont)then
secFont=love.filesystem.newFile(secFont) secFont=love.filesystem.newFile(secFont)

View File

@@ -46,7 +46,7 @@ end
--Load modules --Load modules
Z=require'Zframework' Z=require'Zframework'
FONT.init('parts/fonts/proportional.ttf') FONT.load('parts/fonts/proportional.ttf')
SCR.setSize(1280,720)--Initialize Screen size SCR.setSize(1280,720)--Initialize Screen size
BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end) BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end)

View File

@@ -685,7 +685,7 @@ do--function drawSelfProfile()
return img return img
end}) end})
local name local name
local textObject,scaleK,width,offY local textObj,scaleK,width,offY
function drawSelfProfile() function drawSelfProfile()
local selfAvatar=USERS.getAvatar(USER.uid) local selfAvatar=USERS.getAvatar(USER.uid)
gc_push('transform') gc_push('transform')
@@ -701,12 +701,12 @@ do--function drawSelfProfile()
--Draw username --Draw username
if name~=USERS.getUsername(USER.uid)then if name~=USERS.getUsername(USER.uid)then
name=USERS.getUsername(USER.uid) name=USERS.getUsername(USER.uid)
textObject=gc.newText(getFont(30),name) textObj=gc.newText(getFont(30),name)
width=textObject:getWidth() width=textObj:getWidth()
scaleK=210/math.max(width,210) scaleK=210/math.max(width,210)
offY=textObject:getHeight()/2 offY=textObj:getHeight()/2
end end
gc_draw(textObject,-82,26,nil,scaleK,nil,width,offY) gc_draw(textObj,-82,26,nil,scaleK,nil,width,offY)
--Draw lv. & xp. --Draw lv. & xp.
gc_draw(lvIcon[USER.lv],-295,50) gc_draw(lvIcon[USER.lv],-295,50)