整理代码

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
function FONT.init(mainFont,secFont)
assert(love.filesystem.getInfo(mainFont))
function FONT.load(mainFont,secFont)
assert(love.filesystem.getInfo(mainFont),"Font file '"..mainFont.."' not exist!")
mainFont=love.filesystem.newFile(mainFont)
if secFont and love.filesystem.getInfo(secFont)then
secFont=love.filesystem.newFile(secFont)

View File

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

View File

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