From: Stephen Seo Date: Wed, 9 Aug 2023 04:39:43 +0000 (+0900) Subject: Clamp dt: mitigate weird regain focus behavior X-Git-Url: https://git.seodisparate.com/tbm-client-edit-config.jpg?a=commitdiff_plain;h=cab92d140bccf947e3c7201f77d49acda21f1abd;p=jumpartifact.com_demo_0 Clamp dt: mitigate weird regain focus behavior --- diff --git a/src/game.cc b/src/game.cc index 3482486..5620b6c 100644 --- a/src/game.cc +++ b/src/game.cc @@ -3,6 +3,9 @@ // local includes #include "screen_trunner.h" +// third party includes +#include + Game::Game() : screen_stack(ScreenStack::new_instance()), prev_time(std::chrono::steady_clock::now()) { @@ -14,7 +17,7 @@ void Game::update() { auto duration = std::chrono::duration_cast( next_time - prev_time); prev_time = next_time; - screen_stack->update(((float)duration.count()) / 1000000); + screen_stack->update(Clamp(((float)duration.count()) / 1000000, 0.0F, 1.0F)); } void Game::draw() { screen_stack->draw(); }