小程序别踩白块使用stencil防止格子画到版面外面去
This commit is contained in:
@@ -292,6 +292,7 @@ function scene.update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function boardStencil()gc.rectangle('fill',300,0,680,720)end
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
setFont(50)
|
setFont(50)
|
||||||
if arcade then
|
if arcade then
|
||||||
@@ -325,6 +326,8 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Draw tiles
|
--Draw tiles
|
||||||
|
gc.stencil(boardStencil)
|
||||||
|
gc.setStencilTest('equal',1)
|
||||||
gc.rectangle('fill',300,0,680,720)
|
gc.rectangle('fill',300,0,680,720)
|
||||||
gc.setColor(COLOR[tileColor])
|
gc.setColor(COLOR[tileColor])
|
||||||
gc.push('transform')
|
gc.push('transform')
|
||||||
@@ -337,7 +340,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
gc.pop()
|
gc.pop()
|
||||||
|
gc.setStencilTest()
|
||||||
--Draw track line
|
--Draw track line
|
||||||
gc.setColor(COLOR.D)
|
gc.setColor(COLOR.D)
|
||||||
gc.setLineWidth(2)
|
gc.setLineWidth(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user