summaryrefslogtreecommitdiffstats
path: root/Imgui/src/ImGuiImplLinuxXCB.cpp
diff options
context:
space:
mode:
authorEgor <egor.yusov@gmail.com>2019-10-02 04:38:53 +0000
committerEgor <egor.yusov@gmail.com>2019-10-02 04:38:53 +0000
commit4adc3cf97a608a16a2e0451a2d44bb05d3a09336 (patch)
tree2a991b278d6d8bea82f557e88f60f0c2cad0e7e6 /Imgui/src/ImGuiImplLinuxXCB.cpp
parentImgui Linux impl: implemented xcb event handling (diff)
downloadDiligentTools-4adc3cf97a608a16a2e0451a2d44bb05d3a09336.tar.gz
DiligentTools-4adc3cf97a608a16a2e0451a2d44bb05d3a09336.zip
Imgui Linux XCB impl: implemented time delta handling
Diffstat (limited to 'Imgui/src/ImGuiImplLinuxXCB.cpp')
-rw-r--r--Imgui/src/ImGuiImplLinuxXCB.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Imgui/src/ImGuiImplLinuxXCB.cpp b/Imgui/src/ImGuiImplLinuxXCB.cpp
index 8d3a0dc..de9777d 100644
--- a/Imgui/src/ImGuiImplLinuxXCB.cpp
+++ b/Imgui/src/ImGuiImplLinuxXCB.cpp
@@ -84,6 +84,8 @@ ImGuiImplLinuxXCB::ImGuiImplLinuxXCB(xcb_connection_t* connection,
io.KeyMap[ImGuiKey_X] = 'X';
io.KeyMap[ImGuiKey_Y] = 'Y';
io.KeyMap[ImGuiKey_Z] = 'Z';
+
+ m_LastTimestamp = std::chrono::high_resolution_clock::now();
}
ImGuiImplLinuxXCB::~ImGuiImplLinuxXCB()
@@ -96,7 +98,12 @@ ImGuiImplLinuxXCB::~ImGuiImplLinuxXCB()
void ImGuiImplLinuxXCB::NewFrame()
{
- //ImGui_ImplWin32_NewFrame();
+ auto now = std::chrono::high_resolution_clock::now();
+ auto elapsed_ns = now - m_LastTimestamp;
+ m_LastTimestamp = now;
+ auto& io = ImGui::GetIO();
+ io.DeltaTime = static_cast<float>(elapsed_ns.count() / 1e+9);
+
ImGuiImplDiligent::NewFrame();
}
@@ -208,10 +215,10 @@ void ImGuiImplLinuxXCB::HandleKeyEvent(xcb_key_release_event_t* event)
}
}
}
-
+
io.AddInputCharacter(keysym);
}
- }
+ }
}
if (k != 0)