From bd78892164028b51fc714d78814f9a0d8d44b556 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 8 Oct 2015 15:28:09 +0200 Subject: [PATCH] Fixed IsKeyReleased() and IsMouseReleased() returning true on the first frame. Loosely related to #362 --- imgui.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 613e553e..05271848 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -704,6 +704,10 @@ ImGuiIO::ImGuiIO() MouseDoubleClickTime = 0.30f; MouseDoubleClickMaxDist = 6.0f; MouseDragThreshold = 6.0f; + for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) + MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f; + for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) + KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f; for (int i = 0; i < ImGuiKey_COUNT; i++) KeyMap[i] = -1; KeyRepeatDelay = 0.250f;