toolfunc文件拆分

This commit is contained in:
MrZ626
2021-02-13 04:05:28 +08:00
parent bdb8b91e1f
commit 9f285d21ef
15 changed files with 686 additions and 692 deletions

38
Zframework/setFont.lua Normal file
View File

@@ -0,0 +1,38 @@
local gc=love.graphics
local newFont=gc.setNewFont
local setNewFont=gc.setFont
local fontCache,currentFontSize={}
if love.filesystem.getInfo("font.ttf")then
local fontData=love.filesystem.newFile("font.ttf")
function setFont(s)
if s~=currentFontSize then
if not fontCache[s]then
fontCache[s]=newFont(fontData,s)
end
setNewFont(fontCache[s])
currentFontSize=s
end
end
function getFont(s)
if not fontCache[s]then
fontCache[s]=newFont(fontData,s)
end
return fontCache[s]
end
else
function setFont(s)
if s~=currentFontSize then
if not fontCache[s]then
fontCache[s]=newFont(s)
end
setNewFont(fontCache[s])
currentFontSize=s
end
end
function getFont(s)
if not fontCache[s]then
fontCache[s]=newFont(s)
end
return fontCache[s]
end
end