整理代码

This commit is contained in:
MrZ626
2021-03-25 16:43:47 +08:00
parent 1f2652cc5e
commit fac14772f5
2 changed files with 174 additions and 189 deletions

View File

@@ -54,7 +54,6 @@ return{
mStr(P.stat.row,69,225) mStr(P.stat.row,69,225)
mText(drawableText.line,69,290) mText(drawableText.line,69,290)
gc.push("transform") gc.push("transform")
PLY.draw.applyFieldxOy(P)
PLY.draw.applyFieldOffset(P) PLY.draw.applyFieldOffset(P)
if P.modeData.showMark==0 then if P.modeData.showMark==0 then
local mark=TEXTURE.puzzleMark local mark=TEXTURE.puzzleMark
@@ -62,7 +61,7 @@ return{
for y=1,20 do for x=1,10 do for y=1,20 do for x=1,10 do
local T=F[y][x] local T=F[y][x]
if T~=0 then if T~=0 then
gc.draw(mark[T],150+30*x-30,600-30*y) gc.draw(mark[T],30*x-30,600-30*y)
end end
end end end end
end end

View File

@@ -520,10 +520,8 @@ function draw.drawNext_hidden(P)
gc_pop() gc_pop()
end end
function draw.applyFieldxOy() function draw.applyFieldOffset(P,notNorm)
gc_translate(150,0) if not notNorm then gc_translate(150,0)end
end
function draw.applyFieldOffset(P)
local O=P.fieldOff local O=P.fieldOff
gc_translate(O.x,O.y) gc_translate(O.x,O.y)
gc_translate(150,300) gc_translate(150,300)
@@ -535,7 +533,6 @@ function draw.drawTargetLine(P,r)
gc_setLineWidth(4) gc_setLineWidth(4)
gc_setColor(1,r>10 and 0 or rnd(),.5) gc_setColor(1,r>10 and 0 or rnd(),.5)
gc_push("transform") gc_push("transform")
draw.applyFieldxOy(P)
draw.applyFieldOffset(P) draw.applyFieldOffset(P)
gc_line(0,600-30*r,300,600-30*r) gc_line(0,600-30*r,300,600-30*r)
gc_pop() gc_pop()
@@ -550,10 +547,6 @@ function draw.norm(P)
gc_translate(P.x,P.y)gc_scale(P.size) gc_translate(P.x,P.y)gc_scale(P.size)
--Field-related things --Field-related things
gc_push("transform")
draw.applyFieldxOy(P)
--Things shake with field
gc_push("transform") gc_push("transform")
draw.applyFieldOffset(P) draw.applyFieldOffset(P)
@@ -662,8 +655,6 @@ function draw.norm(P)
end end
gc_setStencilTest() gc_setStencilTest()
end end
gc_pop()
--Bonus texts --Bonus texts
TEXT.draw(P.bonus) TEXT.draw(P.bonus)
@@ -711,17 +702,13 @@ function draw.norm_remote(P)
--Field-related things --Field-related things
gc_push("transform") gc_push("transform")
draw.applyFieldxOy(P) draw.applyFieldOffset(P)
--Draw username --Draw username
setFont(30) setFont(30)
gc_setColor(1,1,1) gc_setColor(1,1,1)
mStr(P.userName,150,-60) mStr(P.userName,150,-60)
--Things shake with field
gc_push("transform")
draw.applyFieldOffset(P)
--Fill field --Fill field
gc_setColor(0,0,0,.6) gc_setColor(0,0,0,.6)
gc_rectangle("fill",0,-10,300,610) gc_rectangle("fill",0,-10,300,610)
@@ -818,7 +805,6 @@ function draw.norm_remote(P)
end end
gc_setStencilTest() gc_setStencilTest()
end end
gc_pop()
--Bonus texts --Bonus texts
TEXT.draw(P.bonus) TEXT.draw(P.bonus)
@@ -913,7 +899,7 @@ function draw.demo(P)
gc_translate(P.x,P.y) gc_translate(P.x,P.y)
gc_scale(P.size) gc_scale(P.size)
gc_push("transform") gc_push("transform")
draw.applyFieldOffset(P) draw.applyFieldOffset(P,true)
--Frame --Frame
gc_setColor(0,0,0,.6) gc_setColor(0,0,0,.6)