[LWJGL][LIBGDX] window drag problems.

Hi, I’m using libGdx to do a game, so far was so good, but I figured that if I move the window while the game is running (Example: I shoot and right after that I move the window with the cursor) the Render process stops, but all other process continues, the game don’t stop entirely, that causes various problems, since it doesn’t stop update methods some collisions get messed when I move the window, some keys freezes… any one know an work around? I read that it is a problem with Display implementation… so I tried to use JFrame to substituite it, but it doesn’t worked well, messed all my game, resize gets really weird with JFrame… any tips? ty…

Pause your game.

If the cursor leaves the frustum or the window loses focus, switch to a paused state.

The problem was that this Display don’t return false focus if the window is dragged, it still returns true…
I found a workaround by checking if delta time is > 1, i don’t think that frames will normally be that high…

Thanks for the answer, the cursor leaves the frustum is a nice ideia too, i will try to implement it…

I think you can fix this by settings the backgroundFPS to -1 in your LwjglApplicationConfiguration (in your desktop launcher).

From: https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglApplicationConfiguration.java


	/** Target framerate when the window is not in the foreground. The CPU sleeps as needed. Use 0 to never sleep, -1 to not render. **/
	public int backgroundFPS = 60;

The window is still focused.

Let me know how that turns out, was a shot in the dark from my end but seemed logical Lol.