Pausing.
Posted: Thu Dec 29, 2011 9:17 pm
I was wondering if there was a way to freeze the framerate completely? I was going to use this to pause the game when the window is unfocused or you push "p".
Thanks:-)
Thanks:-)
Code: Select all
function love.update(dt)
...
end
Code: Select all
paused = false
function love.keypressed(key)
if key == "p" then
paused = not paused
end
end
function love.update(dt)
if paused then return end
...
end
Code: Select all
function love.focus(f)
if not f and not paused then
pause = true
end
end
Whoops, meant to write "not paused".clickrush wrote:why would you write "not false" instead of "true" ?
Wow, that's so simple. I cant believe I didn't think of thatXD thanks!thelinx wrote:To put it in the simplest terms possible, turnintoCode: Select all
function love.update(dt) ... end
Code: Select all
paused = false function love.keypressed(key) if key == "p" then paused = not paused end end function love.update(dt) if paused then return end ... end