Clamp dt: mitigate weird regain focus behavior
This commit is contained in:
parent
cbcf0da5ce
commit
cab92d140b
1 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,9 @@
|
||||||
// local includes
|
// local includes
|
||||||
#include "screen_trunner.h"
|
#include "screen_trunner.h"
|
||||||
|
|
||||||
|
// third party includes
|
||||||
|
#include <raymath.h>
|
||||||
|
|
||||||
Game::Game()
|
Game::Game()
|
||||||
: screen_stack(ScreenStack::new_instance()),
|
: screen_stack(ScreenStack::new_instance()),
|
||||||
prev_time(std::chrono::steady_clock::now()) {
|
prev_time(std::chrono::steady_clock::now()) {
|
||||||
|
@ -14,7 +17,7 @@ void Game::update() {
|
||||||
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
|
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||||
next_time - prev_time);
|
next_time - prev_time);
|
||||||
prev_time = next_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(); }
|
void Game::draw() { screen_stack->draw(); }
|
||||||
|
|
Loading…
Reference in a new issue