From dc2c3fe3cee67a8473e0d2e952a3ef9f6e0df2d7 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 8 Sep 2017 19:48:17 +0200 Subject: Added renderTo method; clear now uses it --- not/Layer.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'not') 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) -- cgit v1.1