升级doGC模块命令

This commit is contained in:
MrZ626
2021-04-19 00:20:35 +08:00
parent 63d3f02abe
commit 026fbc910f
4 changed files with 65 additions and 55 deletions

View File

@@ -1,14 +1,17 @@
local gc=love.graphics
local cmds={
move="translate",
zoom="scale",
rgba="setColor",
lwid="setLineWidth",
trans="translate",
scale="scale",
setCL="setColor",
setLW="setLineWidth",
draw="draw",
line="line",
rect="rectangle",
circ="circle",
poly="polygon",
dLine="line",
fRect=function(...)gc.rectangle("fill",...)end,
dRect=function(...)gc.rectangle("line",...)end,
fCirc=function(...)gc.circle("fill",...)end,
dCirc=function(...)gc.circle("line",...)end,
fPoly=function(...)gc.polygon("line",...)end,
dPoly=function(...)gc.polygon("line",...)end,
}
return function(L)
gc.push()
@@ -18,7 +21,14 @@ return function(L)
gc.setColor(1,1,1)
gc.setLineWidth(1)
for i=3,#L do
gc[cmds[L[i][1]]](unpack(L[i],2))
print(L[i][1])
local cmd=cmds[L[i][1]]
print(L[i][1])
if type(cmd)=="string"then
gc[cmd](unpack(L[i],2))
else
cmd(unpack(L[i],2))
end
end
gc.setCanvas()
gc.pop()