Skip to content

Instantly share code, notes, and snippets.

@Shell64
Created November 4, 2015 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shell64/d6f773bdb7cc28657742 to your computer and use it in GitHub Desktop.
Save Shell64/d6f773bdb7cc28657742 to your computer and use it in GitHub Desktop.
love 0.10.0 stencil API abstraction (like 0.9.2) for my engine.
local CurrentStencil = nil
function Graphics.SetStencil(Stencil)
if Stencil then
Graphics.SetStencilTest(true, false)
Graphics.Stencil(Stencil, false)
CurrentStencil = Stencil
else
CurrentStencil = nil
Graphics.SetStencilTest(false)
end
end
Graphics.setStencil = Graphics.SetStencil
function Graphics.SetInvertedStencil(Stencil)
if Stencil then
Graphics.SetStencilTest(true, true)
Graphics.Stencil(Stencil, false)
CurrentStencil = Stencil
else
CurrentStencil = nil
Graphics.SetStencilTest(false)
end
end
Graphics.setInvertedStencil = Graphics.SetInvertedStencil
function Graphics.GetStencil()
return CurrentStencil
end
Graphics.getStencil = Graphics.GetStencil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment