When I move/resize window without pausing game, game messes up like Goomba instakills Mario beyond obstacles, because Clock is still progressing while window is completely frozen.
First I fixed it by this:
if(frameTime > 1 / 60.f) frameTime = 1 / 60.f;
But this looks unsmart. This may cause lags when fps drops below 60.
Is there any good way? thx.
So...do I have to separate all updatings and drawings like this?
// ......
if(frameTime > 1.f) frameTime = 1.f;
while(frameTime > 1 / 60.f)
{
gameContent.Update(1 / 60.f);
frameTime -= 1 / 60.f;
}
gameContent.Update(frameTime);
gameContent.Draw(window); // or window.draw(gameContent);
window.display();
I've not tested it yet. Applying this to my current code needs a lot of changes, because of my badness which I combined some draw calls and updating sprites/vertices together. :'(