mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Merge remote-tracking branch 'origin' into 2016-07-navigation
This commit is contained in:
commit
cbf24c13ca
38
imgui.cpp
38
imgui.cpp
@ -248,15 +248,15 @@
|
|||||||
- 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons.
|
- 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons.
|
||||||
- 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the "open" state of a popup. BeginPopup() returns true if the popup is opened.
|
- 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the "open" state of a popup. BeginPopup() returns true if the popup is opened.
|
||||||
- 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same).
|
- 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same).
|
||||||
- 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function (will obsolete).
|
- 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function until 1.50.
|
||||||
- 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API
|
- 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API
|
||||||
- 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive.
|
- 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive.
|
||||||
- 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead.
|
- 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead.
|
||||||
- 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function (will obsolete).
|
- 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function until 1.50.
|
||||||
- 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing
|
- 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing
|
||||||
- 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function (will obsolete).
|
- 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function until 1.50.
|
||||||
- 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing)
|
- 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing)
|
||||||
- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function (will obsolete).
|
- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function until 1.50.
|
||||||
- 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.
|
- 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.
|
||||||
- 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.
|
- 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.
|
||||||
- 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior
|
- 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior
|
||||||
@ -1245,6 +1245,20 @@ ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)
|
||||||
|
{
|
||||||
|
ImVec4 c = GImGui->Style.Colors[idx];
|
||||||
|
c.w *= GImGui->Style.Alpha * alpha_mul;
|
||||||
|
return ImGui::ColorConvertFloat4ToU32(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImU32 ImGui::GetColorU32(const ImVec4& col)
|
||||||
|
{
|
||||||
|
ImVec4 c = col;
|
||||||
|
c.w *= GImGui->Style.Alpha;
|
||||||
|
return ImGui::ColorConvertFloat4ToU32(c);
|
||||||
|
}
|
||||||
|
|
||||||
// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592
|
// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592
|
||||||
// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
|
// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
|
||||||
void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v)
|
void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v)
|
||||||
@ -1919,7 +1933,7 @@ void ImGui::ItemSize(const ImVec2& size, float text_offset_y)
|
|||||||
window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
|
window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
|
||||||
window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);
|
window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);
|
||||||
|
|
||||||
//window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, 0xFF0000FF, 4); // Debug
|
//window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // Debug
|
||||||
|
|
||||||
window->DC.PrevLineHeight = line_height;
|
window->DC.PrevLineHeight = line_height;
|
||||||
window->DC.PrevLineTextBaseOffset = text_base_offset;
|
window->DC.PrevLineTextBaseOffset = text_base_offset;
|
||||||
@ -3354,10 +3368,10 @@ void ImGui::Render()
|
|||||||
const ImVec2 size = cursor_data.Size;
|
const ImVec2 size = cursor_data.Size;
|
||||||
const ImTextureID tex_id = g.IO.Fonts->TexID;
|
const ImTextureID tex_id = g.IO.Fonts->TexID;
|
||||||
g.OverlayDrawList.PushTextureID(tex_id);
|
g.OverlayDrawList.PushTextureID(tex_id);
|
||||||
g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(1,0), pos+ImVec2(1,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0x30000000); // Shadow
|
g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(1,0), pos+ImVec2(1,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,48)); // Shadow
|
||||||
g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(2,0), pos+ImVec2(2,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0x30000000); // Shadow
|
g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(2,0), pos+ImVec2(2,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,48)); // Shadow
|
||||||
g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0xFF000000); // Black border
|
g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,255)); // Black border
|
||||||
g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[0], cursor_data.TexUvMax[0], 0xFFFFFFFF); // White fill
|
g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[0], cursor_data.TexUvMax[0], IM_COL32(255,255,255,255)); // White fill
|
||||||
g.OverlayDrawList.PopTextureID();
|
g.OverlayDrawList.PopTextureID();
|
||||||
}
|
}
|
||||||
if (!g.OverlayDrawList.VtxBuffer.empty())
|
if (!g.OverlayDrawList.VtxBuffer.empty())
|
||||||
@ -10048,6 +10062,12 @@ bool ImGui::IsRectVisible(const ImVec2& size)
|
|||||||
return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
|
return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||||
|
{
|
||||||
|
ImGuiWindow* window = GetCurrentWindowRead();
|
||||||
|
return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
|
||||||
|
}
|
||||||
|
|
||||||
// Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)
|
// Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)
|
||||||
void ImGui::BeginGroup()
|
void ImGui::BeginGroup()
|
||||||
{
|
{
|
||||||
|
13
imgui.h
13
imgui.h
@ -417,7 +417,8 @@ namespace ImGui
|
|||||||
IMGUI_API bool IsAnyWindowFocused();
|
IMGUI_API bool IsAnyWindowFocused();
|
||||||
IMGUI_API bool IsAnyWindowHovered(); // is mouse hovering any visible window
|
IMGUI_API bool IsAnyWindowHovered(); // is mouse hovering any visible window
|
||||||
IMGUI_API bool IsAnyWindowHoveredAtPos(const ImVec2& pos); // is given position hovering any active imgui window
|
IMGUI_API bool IsAnyWindowHoveredAtPos(const ImVec2& pos); // is given position hovering any active imgui window
|
||||||
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side (as an optimization)
|
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.
|
||||||
|
IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.
|
||||||
IMGUI_API float GetTime();
|
IMGUI_API float GetTime();
|
||||||
IMGUI_API int GetFrameCount();
|
IMGUI_API int GetFrameCount();
|
||||||
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
||||||
@ -476,15 +477,9 @@ namespace ImGui
|
|||||||
static inline bool CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1<<5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); } // OBSOLETE 1.49+
|
static inline bool CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1<<5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); } // OBSOLETE 1.49+
|
||||||
static inline ImFont* GetWindowFont() { return GetFont(); } // OBSOLETE 1.48+
|
static inline ImFont* GetWindowFont() { return GetFont(); } // OBSOLETE 1.48+
|
||||||
static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETE 1.48+
|
static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETE 1.48+
|
||||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpen(open, 0); } // OBSOLETE 1.34+
|
|
||||||
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE 1.36+
|
|
||||||
static inline bool GetWindowCollapsed() { return ImGui::IsWindowCollapsed(); } // OBSOLETE 1.39+
|
|
||||||
static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE 1.36+
|
|
||||||
static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE 1.36+
|
|
||||||
static inline bool IsClipped(const ImVec2& size) { return !IsRectVisible(size); } // OBSOLETE 1.38+
|
|
||||||
static inline bool IsRectClipped(const ImVec2& size) { return !IsRectVisible(size); } // OBSOLETE 1.39+
|
|
||||||
static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE 1.36+
|
|
||||||
static inline void SetScrollPosHere() { SetScrollHere(); } // OBSOLETE 1.42+
|
static inline void SetScrollPosHere() { SetScrollHere(); } // OBSOLETE 1.42+
|
||||||
|
static inline bool GetWindowCollapsed() { return ImGui::IsWindowCollapsed(); } // OBSOLETE 1.39+
|
||||||
|
static inline bool IsRectClipped(const ImVec2& size) { return !IsRectVisible(size); } // OBSOLETE 1.39+
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
@ -786,9 +786,6 @@ namespace ImGui
|
|||||||
|
|
||||||
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
||||||
|
|
||||||
inline IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul) { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * alpha_mul; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
||||||
inline IMGUI_API ImU32 GetColorU32(const ImVec4& col) { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
|
||||||
|
|
||||||
// NB: All position are in absolute pixels coordinates (not window coordinates)
|
// NB: All position are in absolute pixels coordinates (not window coordinates)
|
||||||
// FIXME: All those functions are a mess and needs to be refactored into something decent. Avoid use outside of imgui.cpp!
|
// FIXME: All those functions are a mess and needs to be refactored into something decent. Avoid use outside of imgui.cpp!
|
||||||
// We need: a sort of symbol library, preferably baked into font atlas when possible + decent text rendering helpers.
|
// We need: a sort of symbol library, preferably baked into font atlas when possible + decent text rendering helpers.
|
||||||
|
Loading…
Reference in New Issue
Block a user