gurkenlabs / litiengine

LITIENGINE 🕹 The pure 2D java game engine.
https://litiengine.com/
MIT License
725 stars 93 forks source link

Weird Tweening Behavior When Window Loses Focus with gfx_reduceFramesWhenNotFocused=true #473

Closed Hades948 closed 1 year ago

Hades948 commented 1 year ago

Describe the bug If the window loses focus after calling Tween.begin() and before the tween ends, sometimes the tween will stop completely and not finish when focus is returned to the window, and sometimes the frame rate drops (expected with gfx_reduceFramesWhenNotFocused=true) but then when the window regains focus, the tween restarts.

To Reproduce Steps to reproduce the behavior:

  1. Do something in your game that will call Tween.begin() on a tween. Ideally something visual and on-screen for testing.
  2. Before the tween finishes, click outside of the window so the window loses focus.
  3. The tween will either stop or the frame rate will drop at this point.
  4. Click on the window to regain focus.
  5. If the tween stopped, it will not complete even once focus is returned to the window. If the tween did not stop, it will restart when focus is regained.

Expected behavior I would expect the tween to continue (at a lower frame rate) when the window loses focus and not restart when focus is regained.

Your System:

Additional context