Merge branch 'master' into navigation

# Conflicts:
#	imgui.cpp
#	imgui.h
#	imgui_internal.h
This commit is contained in:
omar 2017-08-29 16:21:46 +08:00
commit a9e1d9aab9
2 changed files with 12 additions and 6 deletions

View File

@ -3820,12 +3820,14 @@ bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool c
bool ImGui::IsAnyWindowHovered()
{
return GImGui->HoveredWindow != NULL;
ImGuiContext& g = *GImGui;
return g.HoveredWindow != NULL;
}
bool ImGui::IsAnyWindowFocused()
{
return GImGui->NavWindow != NULL;
ImGuiContext& g = *GImGui;
return g.NavWindow != NULL;
}
static bool IsKeyPressedMap(ImGuiKey key, bool repeat)
@ -3870,10 +3872,14 @@ int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_r
bool ImGui::IsKeyPressed(int user_key_index, bool repeat)
{
ImGuiContext& g = *GImGui;
if (repeat)
if (user_key_index < 0) return false;
IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
const float t = g.IO.KeysDownDuration[user_key_index];
if (t == 0.0f)
return true;
if (repeat && t > g.IO.KeyRepeatDelay)
return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0;
else
return GetKeyPressedAmount(user_key_index, 0.0f, 0.0f) > 0;
return false;
}
bool ImGui::IsKeyReleased(int user_key_index)

View File

@ -430,7 +430,7 @@ namespace ImGui
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window
IMGUI_API bool IsWindowFocused(); // is current window focused
IMGUI_API bool IsWindowHovered(); // is current window hovered and hoverable (not blocked by a popup) (differentiate child windows from each others)
IMGUI_API bool IsWindowRectHovered(); // is current window hovered, disregarding of any consideration of being blocked by a popup. (unlike IsWindowHovered() this will return true even if the window is blocked because of a popup)
IMGUI_API bool IsWindowRectHovered(); // is current window rectangle hovered, disregarding of any consideration of being blocked by a popup. (unlike IsWindowHovered() this will return true even if the window is blocked because of a popup)
IMGUI_API bool IsRootWindowFocused(); // is current root window focused (root = top-most parent of a child, otherwise self)
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
IMGUI_API bool IsRootWindowOrAnyChildHovered(); // is current root window or any of its child (including current window) hovered and hoverable (not blocked by a popup)