[SOLVED] Refresh canvas?
Posted: Tue Sep 21, 2021 2:52 pm
I want to refresh a canvas. My code is:
The problem I have is that calling the compose_canvas function with other parameters, still remains the original one, and does not changes.
I tried with love.graphics.clear() but then the first canvas is created but in the second call dissapears.
Any idea?
Code: Select all
local function compose_canvas(x, y)
--love.graphics.clear()
love.graphics.setCanvas(canvas)
love.graphics.setColor(0.8, 0.9, 0.4)
love.graphics.rectangle("fill", x, y, 100, 100)
love.graphics.setCanvas()
end
function love.load()
canvas = love.graphics.newCanvas()
compose_canvas(0, 0)
end
function love.draw()
love.graphics.draw(canvas, 200, 100, 0, 0.5, 0.5)
end
I tried with love.graphics.clear() but then the first canvas is created but in the second call dissapears.
Any idea?