Browse Source

don't pass 0 to ImGui deltaTime

Jeffery Myers 1 year ago
parent
commit
583d4fea67
1 changed files with 4 additions and 1 deletions
  1. 4 1
      rlImGui.cpp

+ 4 - 1
rlImGui.cpp

@@ -103,7 +103,6 @@ static void ImGuiNewFrame(float deltaTime)
 {
     ImGuiIO& io = ImGui::GetIO();
 
-
     Vector2 resolutionScale = GetWindowScaleDPI();
 
 #ifndef PLATFORM_DRM
@@ -130,6 +129,9 @@ static void ImGuiNewFrame(float deltaTime)
 
     io.DisplayFramebufferScale = ImVec2(resolutionScale.x, resolutionScale.y);
 
+    if (deltaTime <= 0)
+        deltaTime = 0.001f;
+
     io.DeltaTime = deltaTime;
 
     if (ImGui::GetIO().BackendFlags & ImGuiBackendFlags_HasMouseCursors)
@@ -446,6 +448,7 @@ void rlImGuiBegin(void)
 void rlImGuiBeginDelta(float deltaTime)
 {
     ImGui::SetCurrentContext(GlobalContext);
+
     ImGuiNewFrame(deltaTime);
     ImGui_ImplRaylib_ProcessEvents();
     ImGui::NewFrame();