From b8620eac26861db64f0ed89051bf537d372c190a Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Sun, 13 Dec 2015 23:39:59 +0100 Subject: [PATCH] Made debug camera detect UI focus properly --- include/Engine/Rendering/DebugCameraInputController.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/Engine/Rendering/DebugCameraInputController.h b/include/Engine/Rendering/DebugCameraInputController.h index 6d5908ef..614b071c 100644 --- a/include/Engine/Rendering/DebugCameraInputController.h +++ b/include/Engine/Rendering/DebugCameraInputController.h @@ -14,9 +14,11 @@ public: virtual bool OnCommand(const Events::InputCommand& e) override { + ImGuiIO& io = ImGui::GetIO(); + if (e.Command == "PrimaryFire") { if (e.Value > 0) { - if (!ImGui::IsMouseHoveringAnyWindow()) { + if (!io.WantCaptureMouse) { LockMouse(); } } else { @@ -25,7 +27,7 @@ public: return false; } - if (m_MouseLocked || e.Value == 0) { + if (!io.WantCaptureKeyboard) { if (e.Command == "Right") { float value = std::max(-1.f, std::min(e.Value, 1.f)); m_Velocity.x = value;