diff options
| author | Egor <egor.yusov@gmail.com> | 2019-10-02 04:38:53 +0000 |
|---|---|---|
| committer | Egor <egor.yusov@gmail.com> | 2019-10-02 04:38:53 +0000 |
| commit | 4adc3cf97a608a16a2e0451a2d44bb05d3a09336 (patch) | |
| tree | 2a991b278d6d8bea82f557e88f60f0c2cad0e7e6 /Imgui/src/ImGuiImplLinuxXCB.cpp | |
| parent | Imgui Linux impl: implemented xcb event handling (diff) | |
| download | DiligentTools-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.cpp | 13 |
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) |
