DELTATIME / pause / move window

Previous topic - Next topic

Poetronic

Hi everyone,

I am experiencing a problem with my deltatime calculations / animations when moving the program window.

When I press the windows key and then move the program window, the animation stops; but when I release the mouse button and the animation resumes, there seem to be some major floating point inaccuracies which break an animation of scrolling letters (angle-based movement / SIN / COS / deltatime). I believe the problem arises from the difference between the time the game is paused and the calculation fo floating point variables when the game is resumed.

Now my question is: Is it possible to just completely stop/pause/interrupt the whole program as soon as the program window is moved / out of focus? AUTOPAUSE TRUE/FALSE works for the program being out of focus, but not for moving the window. How should I deal with those rounding errors? I had a very nice chat with Wampus on IRC yesterday, but we didn't really find a satisfying solution to the problem yet (and Wampus knows a lot more about programming than I do obviously). Maybe someone can help?

Thank you! :-)
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

MrTAToad

Easiest way would be to limit the maximum value the delta time should return...

Poetronic

#2
Hey MrTAToad, average dt limiting is working now. Thanks for the advice!

What I do now: the program calculates an average deltatime based on 100 game loops and then limits the deltatime by that value. From what I can see, this solution works just fine.

:good:
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

MrTAToad

Yes, that should be fine...!