mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-14 11:07:48 +01:00
Added IsMouseHoveringWindow(), IsMouseHoveringAnyWindow()
This commit is contained in:
parent
d58a029285
commit
d5ed586d70
15
imgui.cpp
15
imgui.cpp
@ -1313,7 +1313,7 @@ void NewFrame()
|
|||||||
g.HoveredWindow = ImGui::FindHoveredWindow(g.IO.MousePos, false);
|
g.HoveredWindow = ImGui::FindHoveredWindow(g.IO.MousePos, false);
|
||||||
g.HoveredWindowExcludingChilds = ImGui::FindHoveredWindow(g.IO.MousePos, true);
|
g.HoveredWindowExcludingChilds = ImGui::FindHoveredWindow(g.IO.MousePos, true);
|
||||||
|
|
||||||
// Are we snooping input?
|
// Are we using inputs? Tell user so they can capture/discard them.
|
||||||
g.IO.WantCaptureMouse = (g.HoveredWindow != NULL) || (g.ActiveId != 0);
|
g.IO.WantCaptureMouse = (g.HoveredWindow != NULL) || (g.ActiveId != 0);
|
||||||
g.IO.WantCaptureKeyboard = (g.ActiveId != 0);
|
g.IO.WantCaptureKeyboard = (g.ActiveId != 0);
|
||||||
|
|
||||||
@ -1732,6 +1732,19 @@ bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max)
|
|||||||
return IsMouseHoveringBox(ImGuiAabb(box_min, box_max));
|
return IsMouseHoveringBox(ImGuiAabb(box_min, box_max));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsMouseHoveringWindow()
|
||||||
|
{
|
||||||
|
ImGuiState& g = GImGui;
|
||||||
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
|
return g.HoveredWindow == window;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsMouseHoveringAnyWindow()
|
||||||
|
{
|
||||||
|
ImGuiState& g = GImGui;
|
||||||
|
return g.HoveredWindow != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
|
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
|
||||||
{
|
{
|
||||||
ImGuiState& g = GImGui;
|
ImGuiState& g = GImGui;
|
||||||
|
8
imgui.h
8
imgui.h
@ -178,7 +178,7 @@ namespace ImGui
|
|||||||
float GetColumnOffset(int column_index = -1);
|
float GetColumnOffset(int column_index = -1);
|
||||||
void SetColumnOffset(int column_index, float offset);
|
void SetColumnOffset(int column_index, float offset);
|
||||||
float GetColumnWidth(int column_index = -1);
|
float GetColumnWidth(int column_index = -1);
|
||||||
ImVec2 GetCursorPos(); // cursor position relative to window position
|
ImVec2 GetCursorPos(); // cursor position is relative to window position
|
||||||
void SetCursorPos(const ImVec2& pos); // "
|
void SetCursorPos(const ImVec2& pos); // "
|
||||||
void SetCursorPosX(float x); // "
|
void SetCursorPosX(float x); // "
|
||||||
void SetCursorPosY(float y); // "
|
void SetCursorPosY(float y); // "
|
||||||
@ -260,8 +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 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 IsMouseClicked(int button, bool repeat = false);
|
||||||
bool IsMouseDoubleClicked(int button);
|
bool IsMouseDoubleClicked(int button);
|
||||||
bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max);
|
bool IsMouseHoveringWindow(); // is hovering current window ("window" in API names always refer to current window)
|
||||||
ImVec2 GetMousePos();
|
bool IsMouseHoveringAnyWindow(); // is hovering any active imgui window
|
||||||
|
bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is hovering given bounding box
|
||||||
|
ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
||||||
float GetTime();
|
float GetTime();
|
||||||
int GetFrameCount();
|
int GetFrameCount();
|
||||||
const char* GetStyleColorName(ImGuiCol idx);
|
const char* GetStyleColorName(ImGuiCol idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user