From 85672fec2e5a7d52c58fb4d8caaee89f10604e84 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 24 Sep 2014 15:49:15 +0100 Subject: [PATCH] Added IsPosHoveringAnyWindow() --- imgui.cpp | 5 +++++ imgui.h | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index d7fe03377..eb2f8f057 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1745,6 +1745,11 @@ bool IsMouseHoveringAnyWindow() return g.HoveredWindow != NULL; } +bool IsPosHoveringAnyWindow(const ImVec2& pos) +{ + return ImGui::FindHoveredWindow(pos, false) != NULL; +} + static bool IsKeyPressedMap(ImGuiKey key, bool repeat) { ImGuiState& g = GImGui; diff --git a/imgui.h b/imgui.h index b579ccb1e..ff5b93265 100644 --- a/imgui.h +++ b/imgui.h @@ -260,9 +260,10 @@ namespace ImGui bool IsKeyPressed(int key_index, bool repeat = true); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry bool IsMouseClicked(int button, bool repeat = false); bool IsMouseDoubleClicked(int button); - bool IsMouseHoveringWindow(); // is hovering current window ("window" in API names always refer to current window) - bool IsMouseHoveringAnyWindow(); // is hovering any active imgui window - bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is hovering given bounding box + bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window) + bool IsMouseHoveringAnyWindow(); // is mouse hovering any active imgui window + bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is mouse hovering given bounding box + bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls float GetTime(); int GetFrameCount();