function love.run()
main()
end
function main()
love.graphics.clear({255, 255, 255, 255})
while true do
love.graphics.setColor({0, 0, 0, 255})
love.graphics.circle("fill", 100, 100, 50)
love.graphics.present()
love.timer.sleep(0.25)
end
end
Draws circle half of the time and make screen go black the other half?
I concluded love.graphics.present() caused that but why? How to prevent it?
Yes love.run() is voluntarily like that and needs to be for my purposes.
Also you should try the .love file not the code so you can close the window with the console
function love.run()
main()
end
function main()
while true do
love.graphics.clear({255, 255, 255, 255})
love.graphics.setColor({0, 0, 0, 255})
love.graphics.circle("fill", 100, 100, 50)
love.graphics.present()
love.timer.sleep(0.25)
end
end
EDIT: using love.run that way, you're not going to have the window respond to any external event. That also means Windows thinks the app froze and will try to kill it.
Last edited by Nixola on Sun Aug 14, 2016 5:20 pm, edited 1 time in total.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Probably use [wiki]Canvas[/wiki]es I guess? Is that what you may need? If not, please state what you need to do exactly; we might be able to help more ffectively then
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Alright I want to write a draw library available in a lua programming app so I can run my code on the computer. The user needs to be able to do draw.refresh() as much as he needs. If draw.refresh() also clears, it makes it useless.
Please don't double post, especially since your post is still in the first page.
That said, I'm afraid I still don't understand what you're trying to do.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
I want to prevent the black screen thing.
Why would displaying the graphics without clearing first show a black screen?
I want to be able to show newly drawn graphics without clearing.
Let's say I'm trying to do a paint program.
I want to refresh the screen so the user can see what he draws.
1. If I refresh without clearing: black screen every two frame.
2. If I refresh after clearing: what user drawn has been erased
I know I could register everything drawn but why bother if I can get rid of this black frame?
Just learn how to use [wiki]canvas[/wiki]es instead of messing with love.run. That's not a good way of preserving what happened, because the GPU might automatically fill the buffer with gibberish and/or clear it after calling love.graphics.present.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
You need to "bother" because you can't do it otherwise, due to people implementing windowing systems this way.
If you want to retain what was drawn n frames before, then you need a canvas; The main window's contents must be invalidated with love.graphics.clear every frame, otherwise you may get garbage shown to you.
Just create one canvas the size of the program's window, draw to that, then draw that every frame. Problem solved.
Also, i see that you replaced love.run; i didn't check out your .love file, but i hope you do have the event loops and whatnot that are in the default love.run somewhere, otherwise you can't use inputs or night anything.
Edit: wow, ninja'd by 2 minutes... getting slower with typing. : )
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.