I have a gamestate system which draws to a canvas. This drawing works fine and everything appears correctly, however when I attempt to clear the canvas (no longer using canvas:clear(), but love.graphics.clear(...)), it will not actually clear the currently active canvas, and you get that weird sort of constant draw effect when Windows used to freeze a bit with a modal dialog box when you dragged it around.
Now initially I thought this was some weird bug with my code, but I have found that adding the following line of code before actually drawing the canvas to the screen fixes the issue;
Code: Select all
love.graphics.print("HELLO!",0,0)
Code: Select all
function love.draw()
-- Draw to game canvas
g.gfx.setCanvas(g.game_canvas)
g.gfx.clear(50, 150, 100, 255)
-- BEGIN DRAWING HERE
g.gfx.setColor(255, 255, 255, 255)
g.state.draw()
-- END DRAWING HERE
-- Set canvas
g.gfx.setCanvas()
-- Draw game canvas
g.gfx.setColor(255, 255, 255, 255)
g.gfx.print("HI",0,0) -- Add this to stop the canvas from never clearing?!?!?1?!?
g.gfx.draw(g.game_canvas)
end
EDIT: OK, I am really confused. If I switch my state.draw code to drawing directly without using any canvases, everything works fine. As soon as I start using canvases like before everything goes weird. Has the way canvases work and are used changed a lot in 0.10.0 or something?