升级SCR模块,整理大量坐标系变换代码

This commit is contained in:
MrZ626
2021-05-30 02:23:08 +08:00
parent 51d2f43229
commit 9e61505205
20 changed files with 131 additions and 156 deletions

View File

@@ -1,7 +1,6 @@
--Black-White grid
local gc=love.graphics
local gc_push,gc_pop,gc_clear=gc.push,gc.pop,gc.clear
local gc_scale=gc.scale
local gc_clear,gc_scale=gc.clear,gc.scale
local gc_setColor=gc.setColor
local gc_rectangle=gc.rectangle
@@ -19,16 +18,14 @@ function back.update(dt)
end
function back.draw()
gc_clear(.1,.1,.1)
gc_push('transform')
local k=SCR.k
gc_scale(k)
local Y=ceil(SCR.h/80/k)
for x=1,ceil(SCR.w/80/k)do
for y=1,Y do
gc_setColor(1,1,1,sin(x+matrixT[x][y]*t)*.04+.04)
gc_rectangle('fill',80*x,80*y,-80,-80)
end
local k=SCR.k
gc_scale(k)
local Y=ceil(SCR.h/80/k)
for x=1,ceil(SCR.w/80/k)do
for y=1,Y do
gc_setColor(1,1,1,sin(x+matrixT[x][y]*t)*.04+.04)
gc_rectangle('fill',80*x,80*y,-80,-80)
end
gc_pop()
end
end
return back