Page 1 of 1

Game frozen while moving window?

Posted: Thu Feb 28, 2019 7:32 pm
by Kelox
Hey, im currently trying to make a server console with love, but my problem is that while im moving the window the "game" freezes and wont receive any client messages until I let the window go.

Is there a way to keep running code even while Im moving the window? Couldnt find any solution on google/wiki

Re: Game frozen while moving window?

Posted: Thu Feb 28, 2019 10:05 pm
by keharriso
I'm not sure what your code is doing, but this extremely simple example shows that the game should keep running (both drawing and updating) while the window is in motion:

Code: Select all

local t = 0

function love.update(dt)
	t = t + dt
	print(t)
end

function love.draw()
	love.graphics.print(t)
end
Care to share your runnable code?

Re: Game frozen while moving window?

Posted: Thu Feb 28, 2019 10:17 pm
by pgimeno
I believe that's OS-dependent.

Re: Game frozen while moving window?

Posted: Thu Feb 28, 2019 11:21 pm
by keharriso
pgimeno wrote: Thu Feb 28, 2019 10:17 pm I believe that's OS-dependent.
Absolutely correct. Works on Linux, doesn't work on Windows.

On the plus side, it looks like the updating is happening... just the drawing is delayed.

Re: Game frozen while moving window?

Posted: Fri Mar 01, 2019 3:09 am
by zorg
keharriso wrote: Thu Feb 28, 2019 11:21 pm On the plus side, it looks like the updating is happening... just the drawing is delayed.
I think that the whole main thread gets blocked, meaning unless you do all your logic in a different thread, even that will be blocked.

Re: Game frozen while moving window?

Posted: Fri Mar 01, 2019 11:49 am
by Kelox
keharriso wrote: Thu Feb 28, 2019 11:21 pm
pgimeno wrote: Thu Feb 28, 2019 10:17 pm I believe that's OS-dependent.
Absolutely correct. Works on Linux, doesn't work on Windows.

On the plus side, it looks like the updating is happening... just the drawing is delayed.
Sadly update isnt working while moving the window either. Just looks like it is since youre adding deltaTime after you let go :(

zorg wrote: Fri Mar 01, 2019 3:09 am
keharriso wrote: Thu Feb 28, 2019 11:21 pm On the plus side, it looks like the updating is happening... just the drawing is delayed.
I think that the whole main thread gets blocked, meaning unless you do all your logic in a different thread, even that will be blocked.
Will try doing that, thank you =)

Re: Game frozen while moving window?

Posted: Fri Mar 01, 2019 12:30 pm
by zorg
Kelox wrote: Fri Mar 01, 2019 11:49 am
zorg wrote: Fri Mar 01, 2019 3:09 am
keharriso wrote: Thu Feb 28, 2019 11:21 pm On the plus side, it looks like the updating is happening... just the drawing is delayed.
I think that the whole main thread gets blocked, meaning unless you do all your logic in a different thread, even that will be blocked.
Will try doing that, thank you =)
You're welcome, but a few things:
- (Rendering) Graphics only work on the main thread,
- the love.event.pump method also only works on the main thread (called automatically by love.run)

In short, this means:
- Inputs won't get registered while you're dragging the window even if you moved all event processing to another thread, since pump needs to be on the main one.
- Nor will anything be painted onto the window itself for the first reason.

Now, you can still calculate tons of stuff which won't be blocked indeed, but... without input or visual feedback, it might be worse to implement that than have everything pause for the duration of the drag.