Clamp delta time to fix UI disappearing on OS with timestamps that don't always increase.

This commit is contained in:
Dario 2025-02-01 12:10:10 -03:00 committed by Mr-Wiseguy
parent 26a030e059
commit e33441b6db
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ namespace recompui {
}
case EventType::Update: {
std::chrono::high_resolution_clock::duration now = ultramodern::time_since_start();
float delta_time = std::chrono::duration<float>(now - last_time).count();
float delta_time = std::max(std::chrono::duration<float>(now - last_time).count(), 0.0f);
last_time = now;
constexpr float dp_speed = 740.0f;

View File

@ -166,7 +166,7 @@ void ModEntrySpacer::process_event(const Event &e) {
switch (e.type) {
case EventType::Update: {
std::chrono::high_resolution_clock::duration now = ultramodern::time_since_start();
float delta_time = std::chrono::duration<float>(now - last_time).count();
float delta_time = std::max(std::chrono::duration<float>(now - last_time).count(), 0.0f);
constexpr float dp_speed = 1000.0f;
last_time = now;