新增doGC工具函数,三个模式图标改为代码绘制

This commit is contained in:
MrZ626
2021-03-09 23:25:40 +08:00
parent 11d7caa6f6
commit d9dd56f6e2
7 changed files with 79 additions and 29 deletions

25
Zframework/doGC.lua Normal file
View File

@@ -0,0 +1,25 @@
local gc=love.graphics
local cmds={
move="translate",
zoom="scale",
rgb="setColor",
wid="setLineWidth",
line="line",
rect="rectangle",
circ="circle",
poly="polygon",
}
return function(L)
gc.push()
local canvas=gc.newCanvas(L[1],L[2])
gc.setCanvas(canvas)
gc.origin()
gc.setColor(1,1,1)
gc.setLineWidth(1)
for i=3,#L do
gc[cmds[L[i][1]]](unpack(L[i],2))
end
gc.setCanvas()
gc.pop()
return canvas
end

View File

@@ -26,6 +26,7 @@ VIB= require"Zframework/vibrate"
SFX= require"Zframework/sfx"
LIGHT= require"Zframework/light"
DOGC= require"Zframework/doGC"
BG= require"Zframework/background"
WIDGET= require"Zframework/widget"
TEXT= require"Zframework/text"