summaryrefslogtreecommitdiffhomepage
path: root/not/Layer.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-08 19:48:17 +0200
committerAki <nthirtyone@gmail.com>2017-09-08 19:48:17 +0200
commitdc2c3fe3cee67a8473e0d2e952a3ef9f6e0df2d7 (patch)
treedba0197c65f9ad3f44d128cc7222ad582f635203 /not/Layer.lua
parent4faecfbd6495c46c2d93ce314252feeb7879e568 (diff)
downloadroflnauts-dc2c3fe3cee67a8473e0d2e952a3ef9f6e0df2d7.zip
roflnauts-dc2c3fe3cee67a8473e0d2e952a3ef9f6e0df2d7.tar.gz
roflnauts-dc2c3fe3cee67a8473e0d2e952a3ef9f6e0df2d7.tar.bz2
Added renderTo method; clear now uses it
Diffstat (limited to 'not/Layer.lua')
-rw-r--r--not/Layer.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/not/Layer.lua b/not/Layer.lua
index 63c38ac..126b402 100644
--- a/not/Layer.lua
+++ b/not/Layer.lua
@@ -17,12 +17,16 @@ function Layer:setAsCanvas ()
return c
end
-function Layer:clear ()
+function Layer:renderTo (func, ...)
local c = self:setAsCanvas()
- love.graphics.clear()
+ func(...)
love.graphics.setCanvas(c)
end
+function Layer:clear ()
+ self:renderTo(love.graphics.clear)
+end
+
function Layer:draw ()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(self.canvas)