mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
Examples: imgui_impl_osx: Fix for incorrect DeltaTime calculation on mac OS. (#1978)
This commit is contained in:
parent
544db70852
commit
faa7dad537
@ -15,7 +15,7 @@
|
|||||||
// 2018-07-07: Initial version.
|
// 2018-07-07: Initial version.
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
static clock_t g_Time = 0;
|
static CFAbsoluteTime g_Time = 0.0;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
bool ImGui_ImplOSX_Init()
|
bool ImGui_ImplOSX_Init()
|
||||||
@ -94,10 +94,10 @@ void ImGui_ImplOSX_NewFrame(NSView* view)
|
|||||||
io.DisplayFramebufferScale = ImVec2(dpi, dpi);
|
io.DisplayFramebufferScale = ImVec2(dpi, dpi);
|
||||||
|
|
||||||
// Setup time step
|
// Setup time step
|
||||||
if (g_Time == 0)
|
if (g_Time == 0.0)
|
||||||
g_Time = clock();
|
g_Time = CFAbsoluteTimeGetCurrent();
|
||||||
clock_t current_time = clock();
|
CFAbsoluteTime current_time = CFAbsoluteTimeGetCurrent();
|
||||||
io.DeltaTime = (double)(current_time - g_Time) / CLOCKS_PER_SEC;
|
io.DeltaTime = current_time - g_Time;
|
||||||
g_Time = current_time;
|
g_Time = current_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user