To preface this: I know ways to work around this, like using a canvas to store the entire screen and drawing that each time, setting the BackgroundColor to this color, or simply redrawing the background every time, but that's not what I'm asking - I'm wondering why Löve behaves as it does in this case
Love version: 11.1
And I'm probably trying to abuse the engine again, but I'm hoping someone can clear this up for me
If roll my own love.run function, remove the love.graphics.clear call and fill the screen with a single color, once in love.load,
then that should consistently until something is drawn over it, right?
Problem is, on my system (be it natively or in wine), my static background flickers like hell... (Arch linux, but otherwise Löve games run perfectly fine)
Here's the code (.love file in the attachments)
Code: Select all
local lg = love.graphics
function love.load ()
--initial drawing of the background
lg.setColor(.5,.5,0,1)
lg.rectangle("fill",0,0,lg.getWidth(),lg.getHeight())
end
function love.draw ()
--just to show that everything which is drawn every frame, is actually also redrawn.
lg.setColor(1,0,0,1)
lg.rectangle("fill", 10,10,100,100)
end
function love.update (dt)
if love.keyboard.isDown("escape") then
love.event.quit()
end
end
function love.run()
if love.load then love.load(love.arg.parseGameArguments(arg), arg) end
if love.timer then love.timer.step() end
local dt = 0
return function()
if love.event then
love.event.pump()
for name, a,b,c,d,e,f in love.event.poll() do
if name == "quit" then
if not love.quit or not love.quit() then
return a or 0
end
end
love.handlers[name](a,b,c,d,e,f)
end
end
if love.timer then dt = love.timer.step() end
if love.update then love.update(dt) end
if lg and lg.isActive() then
--love.graphics.clear is omitted to be able to keep the background across frames
if love.draw then love.draw() end
lg.present()
end
if love.timer then love.timer.sleep(0.001) end
end
end