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:-)
Pausing.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Pausing.
To put it in the simplest terms possible, turn
into
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
Last edited by thelinx on Thu Dec 29, 2011 10:57 pm, edited 1 time in total.
Reason: not false -> not paused
Reason: not false -> not paused
Re: Pausing.
And for when you lose focus:
Code: Select all
function love.focus(f)
if not f and not paused then
pause = true
end
end
Re: Pausing.
Whoops, meant to write "not paused".clickrush wrote:why would you write "not false" instead of "true" ?
- baconhawka7x
- Party member
- Posts: 491
- Joined: Mon Nov 21, 2011 7:05 am
- Location: Oregon, USA
- Contact:
Re: Pausing.
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
Who is online
Users browsing this forum: No registered users and 214 guests