Update stencil calls

This commit is contained in:
Raman Varabets 2015-10-31 21:43:07 +08:00
parent 4ef34ccc5b
commit 11b49a7554
8 changed files with 24 additions and 16 deletions

View File

@ -154,13 +154,14 @@ function newobject:draw()
v:draw() v:draw()
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
for k, v in ipairs(children) do for k, v in ipairs(children) do
v:draw() v:draw()
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
end end

View File

@ -132,7 +132,8 @@ function newobject:draw()
drawfunc(self) drawfunc(self)
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
for k, v in ipairs(self.children) do for k, v in ipairs(self.children) do
local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, width, v.width, height, v.height) local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, width, v.width, height, v.height)
@ -141,7 +142,7 @@ function newobject:draw()
end end
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
for k, v in ipairs(self.internals) do for k, v in ipairs(self.internals) do
v:draw() v:draw()

View File

@ -108,7 +108,8 @@ function newobject:draw()
-- set the object's draw order -- set the object's draw order
self:SetDrawOrder() self:SetDrawOrder()
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
if draw then if draw then
draw(self) draw(self)
@ -116,7 +117,7 @@ function newobject:draw()
drawfunc(self) drawfunc(self)
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
end end

View File

@ -173,7 +173,8 @@ function newobject:draw()
v:draw() v:draw()
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
for k, v in ipairs(children) do for k, v in ipairs(children) do
local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height) local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height)
@ -182,7 +183,7 @@ function newobject:draw()
end end
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
if not draw then if not draw then
drawoverfunc(self) drawoverfunc(self)

View File

@ -163,7 +163,8 @@ function newobject:draw()
drawfunc(self) drawfunc(self)
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
for k, v in ipairs(children) do for k, v in ipairs(children) do
local col = loveframes.util.BoundingBox(x, v.x, y, v.y, width, v.width, height, v.height) local col = loveframes.util.BoundingBox(x, v.x, y, v.y, width, v.width, height, v.height)
@ -172,7 +173,7 @@ function newobject:draw()
end end
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
v:draw() v:draw()

View File

@ -164,7 +164,8 @@ function newobject:draw()
drawfunc(self) drawfunc(self)
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
local col = loveframes.util.BoundingBox(x + self.buttonareax, v.x, self.y, v.y, self.buttonareawidth, v.width, tabheight, v.height) local col = loveframes.util.BoundingBox(x + self.buttonareax, v.x, self.y, v.y, self.buttonareawidth, v.width, tabheight, v.height)
@ -173,7 +174,7 @@ function newobject:draw()
end end
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
if #self.children > 0 then if #self.children > 0 then
self.children[self.tab]:draw() self.children[self.tab]:draw()

View File

@ -302,7 +302,8 @@ function newobject:draw()
stencilfunc = function() love.graphics.rectangle("fill", x, y, width - 16, height - 16) end stencilfunc = function() love.graphics.rectangle("fill", x, y, width - 16, height - 16) end
end end
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
if draw then if draw then
draw(self) draw(self)
@ -310,7 +311,7 @@ function newobject:draw()
drawfunc(self) drawfunc(self)
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
v:draw() v:draw()

View File

@ -193,7 +193,8 @@ function newobject:draw()
-- set the object's draw order -- set the object's draw order
self:SetDrawOrder() self:SetDrawOrder()
love.graphics.setStencil(stencilfunc) love.graphics.stencil(stencilfunc)
love.graphics.setStencilTest(true)
if draw then if draw then
draw(self) draw(self)
@ -205,7 +206,7 @@ function newobject:draw()
v:draw() v:draw()
end end
love.graphics.setStencil() love.graphics.setStencilTest(false)
for k, v in ipairs(self.internals) do for k, v in ipairs(self.internals) do
v:draw() v:draw()