Page 2 of 2

Re: Screen goes black half of the time love.graphics.present()

Posted: Sun Aug 14, 2016 9:22 pm
by Croutonix
Ok thanks!
I adapted love.run to my purposes it's ok I still have events.
But do I need to process even events I don't need?

Re: Screen goes black half of the time love.graphics.present()

Posted: Sun Aug 14, 2016 9:28 pm
by Nixola
You most likely need every event. If you don't need them, there's nearly no overhead - you'd have more if you tried to figure out what events you need, I think.

Re: Screen goes black half of the time love.graphics.present()

Posted: Sun Aug 14, 2016 9:43 pm
by Croutonix
Is there something wrong in this? I used it to replace love.graphics.present()
Everything drawn is drawn in the canvas.

Code: Select all

love.graphics.setCanvas()       -- Set target to screen
love.graphics.draw(canvas)      -- Draw canvas to screen
love.graphics.present()         -- Refresh screen
love.graphics.setCanvas(canvas) -- Set target to canvas
I only get black screen

Re: Screen goes black half of the time love.graphics.present()

Posted: Sun Aug 14, 2016 9:49 pm
by Nixola
You don't need to replace anything or to alter love.run. Just draw whatever needs to stay to a canvas, then draw the canvas itself to screen:

Code: Select all

love.draw = function()
  love.graphics.setCanvas(canvas)
  --do whatever;draw a line, draw a circle, an image, whatever you need
  love.graphics.setCanvas()
  love.graphics.draw(canvas)
end

Re: Screen goes black half of the time love.graphics.present()

Posted: Sun Aug 14, 2016 11:23 pm
by Croutonix
I changed it to

Code: Select all

love.graphics.setColor(255, 255, 255, 255)
love.graphics.setCanvas()       -- Set target to screen
love.graphics.draw(canvas)      -- Draw canvas to screen
love.graphics.present()         -- Refresh screen
love.graphics.setCanvas(canvas) -- Set target to canvas
It works well now

Re: Screen goes black half of the time love.graphics.present()

Posted: Mon Aug 15, 2016 1:56 pm
by Croutonix
Hey when I use love.graphics.scale or scale on love.graphics.draw(canvas), sometimes love.exe crashes randomly. Sometimes when I quit the program it crashes but sometimes it crashes in the middle of it? This is not a memory crash.

Also when I use my zoom in function, the screen gets refreshed after window is resize and I can often see the whole frame flashing upside down beneath the normal frame? There is no rotation anywhere in my code why does this happen?

EDIT: the crash always happens when I quit the program and if the window was resized by the program during execution.