|
@@ -521,11 +521,11 @@
|
|
|
|
|
|
Q: How can I easily use icons in my application?
|
|
|
A: The most convenient and practical way is to merge an icon font such as FontAwesome inside you main font. Then you can refer to icons within your
|
|
|
- strings. Read 'How can I load multiple fonts?' and the file 'extra_fonts/README.txt' for instructions and useful header files.
|
|
|
+ strings. Read 'How can I load multiple fonts?' and the file 'misc/fonts/README.txt' for instructions and useful header files.
|
|
|
|
|
|
Q: How can I load multiple fonts?
|
|
|
A: Use the font atlas to pack them into a single texture:
|
|
|
- (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.)
|
|
|
+ (Read misc/fonts/README.txt and the code in ImFontAtlas for more details.)
|
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO();
|
|
|
ImFont* font0 = io.Fonts->AddFontDefault();
|
|
@@ -678,7 +678,7 @@ static void SaveIniSettingsToDisk(const char* ini_filename);
|
|
|
static void SaveIniSettingsToMemory(ImVector<char>& out_buf);
|
|
|
static void MarkIniSettingsDirty(ImGuiWindow* window);
|
|
|
|
|
|
-static ImRect GetVisibleRect();
|
|
|
+static ImRect GetViewportRect();
|
|
|
|
|
|
static void CloseInactivePopups(ImGuiWindow* ref_window);
|
|
|
static void ClosePopupToLevel(int remaining);
|
|
@@ -746,7 +746,7 @@ ImGuiStyle::ImGuiStyle()
|
|
|
Alpha = 1.0f; // Global alpha applies to everything in ImGui
|
|
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
|
|
WindowRounding = 7.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
|
|
- WindowBorderSize = 0.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
+ WindowBorderSize = 1.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
|
|
WindowMinSize = ImVec2(32,32); // Minimum window size
|
|
|
WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
|
|
|
ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
|
@@ -2867,9 +2867,9 @@ static int ChildWindowComparer(const void* lhs, const void* rhs)
|
|
|
return (a->BeginOrderWithinParent - b->BeginOrderWithinParent);
|
|
|
}
|
|
|
|
|
|
-static void AddWindowToSortedBuffer(ImVector<ImGuiWindow*>& out_sorted_windows, ImGuiWindow* window)
|
|
|
+static void AddWindowToSortedBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window)
|
|
|
{
|
|
|
- out_sorted_windows.push_back(window);
|
|
|
+ out_sorted_windows->push_back(window);
|
|
|
if (window->Active)
|
|
|
{
|
|
|
int count = window->DC.ChildWindows.Size;
|
|
@@ -3060,7 +3060,7 @@ void ImGui::EndFrame()
|
|
|
ImGuiWindow* window = g.Windows[i];
|
|
|
if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it
|
|
|
continue;
|
|
|
- AddWindowToSortedBuffer(g.WindowsSortBuffer, window);
|
|
|
+ AddWindowToSortedBuffer(&g.WindowsSortBuffer, window);
|
|
|
}
|
|
|
|
|
|
IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
|
|
@@ -3714,7 +3714,7 @@ ImVec2 ImGui::GetItemRectSize()
|
|
|
return window->DC.LastItemRect.GetSize();
|
|
|
}
|
|
|
|
|
|
-static ImRect GetVisibleRect()
|
|
|
+static ImRect GetViewportRect()
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
if (g.IO.DisplayVisibleMin.x != g.IO.DisplayVisibleMax.x && g.IO.DisplayVisibleMin.y != g.IO.DisplayVisibleMax.y)
|
|
@@ -4133,7 +4133,7 @@ static ImVec2 FindBestWindowPosForPopup(const ImVec2& ref_pos, const ImVec2& siz
|
|
|
// r_avoid = the rectangle to avoid (e.g. for tooltip it is a rectangle around the mouse cursor which we want to avoid. for popups it's a small point around the cursor.)
|
|
|
// r_outer = the visible area rectangle, minus safe area padding. If our popup size won't fit because of safe area padding we ignore it.
|
|
|
ImVec2 safe_padding = style.DisplaySafeAreaPadding;
|
|
|
- ImRect r_outer(GetVisibleRect());
|
|
|
+ ImRect r_outer(GetViewportRect());
|
|
|
r_outer.Expand(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? -safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? -safe_padding.y : 0.0f));
|
|
|
ImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size);
|
|
|
//GImGui->OverlayDrawList.AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));
|
|
@@ -4573,7 +4573,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
{
|
|
|
// Adjust passed "client size" to become a "window size"
|
|
|
window->SizeContentsExplicit = g.NextWindowData.ContentSizeVal;
|
|
|
- window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight();
|
|
|
+ if (window->SizeContentsExplicit.y != 0.0f)
|
|
|
+ window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight();
|
|
|
g.NextWindowData.ContentSizeCond = 0;
|
|
|
}
|
|
|
else if (first_begin_of_the_frame)
|
|
@@ -4698,9 +4699,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
float size_x_for_scrollbars = size_full_modified.x != FLT_MAX ? window->SizeFull.x : window->SizeFullAtLastBegin.x;
|
|
|
float size_y_for_scrollbars = size_full_modified.y != FLT_MAX ? window->SizeFull.y : window->SizeFullAtLastBegin.y;
|
|
|
window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
|
- window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
|
+ window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
|
if (window->ScrollbarX && !window->ScrollbarY)
|
|
|
- window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars + style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
|
+ window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);
|
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
|
}
|
|
|
|
|
@@ -4807,15 +4808,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window->DrawList->Clear();
|
|
|
window->DrawList->Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
|
|
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
|
|
- ImRect fullscreen_rect(GetVisibleRect());
|
|
|
+ ImRect viewport_rect(GetViewportRect());
|
|
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
|
|
|
PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true);
|
|
|
else
|
|
|
- PushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true);
|
|
|
+ PushClipRect(viewport_rect.Min, viewport_rect.Max, true);
|
|
|
|
|
|
// Draw modal window background (darkens what is behind them)
|
|
|
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
|
|
- window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
|
+ window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
|
|
|
|
|
// Draw window + handle manual resize
|
|
|
const float window_rounding = window->WindowRounding;
|
|
@@ -11705,7 +11706,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
ImGui::Text("%d vertices, %d indices (%d triangles)", ImGui::GetIO().MetricsRenderVertices, ImGui::GetIO().MetricsRenderIndices, ImGui::GetIO().MetricsRenderIndices / 3);
|
|
|
ImGui::Text("%d allocations", GImAllocatorActiveAllocationsCount);
|
|
|
static bool show_clip_rects = true;
|
|
|
- ImGui::Checkbox("Show clipping rectangles when hovering an ImDrawCmd", &show_clip_rects);
|
|
|
+ ImGui::Checkbox("Show clipping rectangles when hovering draw commands", &show_clip_rects);
|
|
|
ImGui::Separator();
|
|
|
|
|
|
struct Funcs
|
|
@@ -11738,7 +11739,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
continue;
|
|
|
}
|
|
|
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
|
|
- bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
|
|
+ bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
|
|
if (show_clip_rects && ImGui::IsItemHovered())
|
|
|
{
|
|
|
ImRect clip_rect = pcmd->ClipRect;
|
|
@@ -11763,7 +11764,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
{
|
|
|
ImDrawVert& v = draw_list->VtxBuffer[idx_buffer ? idx_buffer[vtx_i] : vtx_i];
|
|
|
triangles_pos[n] = v.pos;
|
|
|
- buf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), "%s %04d { pos = (%8.2f,%8.2f), uv = (%.6f,%.6f), col = %08X }\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
|
|
+ buf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
|
|
|
}
|
|
|
ImGui::Selectable(buf, false);
|
|
|
if (ImGui::IsItemHovered())
|
|
@@ -11821,7 +11822,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|
|
}
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
- if (ImGui::TreeNode("Basic state"))
|
|
|
+ if (ImGui::TreeNode("Internal state"))
|
|
|
{
|
|
|
ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL");
|
|
|
ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL");
|