mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2025-04-16 14:42:30 +00:00
Clamp delta time to fix UI disappearing on OS with timestamps that don't always increase.
This commit is contained in:
parent
eea1a5685e
commit
3ef74955b6
@ -98,7 +98,7 @@ namespace recompui {
|
|||||||
}
|
}
|
||||||
case EventType::Update: {
|
case EventType::Update: {
|
||||||
std::chrono::high_resolution_clock::duration now = ultramodern::time_since_start();
|
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;
|
last_time = now;
|
||||||
|
|
||||||
constexpr float dp_speed = 740.0f;
|
constexpr float dp_speed = 740.0f;
|
||||||
|
@ -166,7 +166,7 @@ void ModEntrySpacer::process_event(const Event &e) {
|
|||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case EventType::Update: {
|
case EventType::Update: {
|
||||||
std::chrono::high_resolution_clock::duration now = ultramodern::time_since_start();
|
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;
|
constexpr float dp_speed = 1000.0f;
|
||||||
last_time = now;
|
last_time = now;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user