Canvas = {class = "Canvas"} function Canvas:New(name) local o = {} o.name = name o.width = game.width/game.scale o.height = game.height/game.scale o.canvas = love.graphics.newCanvas(o.width,o.height) setmetatable(o, self) self.__index = self return o end function Canvas:Recreate() self.canvas:release() self = Canvas:New(self.name) end function Canvas:Reset() love.graphics.setCanvas(self.canvas) love.graphics.setBlendMode("replace") love.graphics.setColor(0,0,0,0) love.graphics.rectangle( "fill", 0, 0, self.width, self.height ) love.graphics.setCanvas() end function Canvas:DrawingStart() self:Reset() love.graphics.setCanvas(self.canvas) end function Canvas:DrawingEnd() love.graphics.setCanvas() love.graphics.setBlendMode("alpha") love.graphics.setColor(1,1,1,1) end function Canvas:Draw() love.graphics.draw(self.canvas) end require "code/canvasses/darkness"