几个绘图用函数mXXX模块化

This commit is contained in:
MrZ626
2021-03-05 13:05:59 +08:00
parent 79bc8f9527
commit 25efce87dc
3 changed files with 24 additions and 9 deletions

View File

@@ -8,13 +8,16 @@ LOADLIB=require"Zframework/loadLib"
WHEELMOV=require"Zframework/wheelScroll"
require"Zframework/setFont"
require"Zframework/mDraw"
MDRAW=require"Zframework/mDraw"
mStr=MDRAW.str
mText=MDRAW.simpX
mDraw=MDRAW.draw
-- UPPERCHAR=require"Zframework/upperChar"
JSON=require"Zframework/json"
DUMPTABLE=require"Zframework/dumpTable"
URLENCODE=require"Zframework/urlEncode"
-- UPPERCHAR=require"Zframework/upperChar"
TABLE=require"Zframework/tableExtend"
SPLITSTR=require"Zframework/splitStr"
TIMESTR=require"Zframework/timeStr"

View File

@@ -1,11 +1,22 @@
local printf=love.graphics.printf
local draw=love.graphics.draw
function mStr(s,x,y)
printf(s,x-626,y,1252,"center")
local mDraw={}
function mDraw.str(str,x,y)
printf(str,x-626,y,1252,"center")
end
function mText(s,x,y)
draw(s,x-s:getWidth()*.5,y)
function mDraw.simpX(str,x,y)
draw(str,x-str:getWidth()*.5,y)
end
function mDraw(s,x,y,a,k)
draw(s,x,y,a,k,nil,s:getWidth()*.5,s: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