Author Topic: DELTATIME / pause / move window  (Read 1567 times)

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
DELTATIME / pause / move window
« on: 2012-Aug-03 »
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

  • Guest
Re: DELTATIME / pause / move window
« Reply #1 on: 2012-Aug-03 »
Easiest way would be to limit the maximum value the delta time should return...

Offline Poetronic

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: DELTATIME / pause / move window
« Reply #2 on: 2012-Aug-03 »
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:
« Last Edit: 2012-Aug-03 by Poetronic »
ILI-Blocks, my first game ever - please check it out! http://www.glbasic.com/forum/index.php?topic=8654.0

MrTAToad

  • Guest
Re: DELTATIME / pause / move window
« Reply #3 on: 2012-Aug-03 »
Yes, that should be fine...!