Canvas only visible for one frame after I click.
Posted: Sat Aug 01, 2015 3:22 pm
I was experimenting with the canvas. In the test when you click a green dot is placed at your cursor position, but the green dots are only visible for a short time after you click.
This is my entire code:
This is my entire code:
Code: Select all
function love.load()
dots = love.graphics.newCanvas(800, 600)
love.mouse.setVisible(false)
end
function love.mousepressed(x, y, button)
if button == "l" then
love.graphics.setCanvas(dots)
love.graphics.setColor(0, 255, 0, 255)
love.graphics.circle("fill", x, y, 10, 16)
love.graphics.setCanvas()
end
end
function love.draw()
love.graphics.setBlendMode('premultiplied')
love.graphics.draw(dots)
local x, y = love.mouse.getPosition()
love.graphics.setColor(255, 0, 0)
love.graphics.circle("fill", x, y, 20, 16)
end