mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00:00
Metrics: Draw window bounding boxes when hovering Pos/Size. List all draw layers, trimming empty commands like Render() does.
This commit is contained in:
parent
9912f7eef8
commit
cbc9730798
10
imgui.cpp
10
imgui.cpp
@ -10590,6 +10590,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
int elem_offset = 0;
|
||||
for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++)
|
||||
{
|
||||
if (pcmd->UserCallback == NULL && pcmd->ElemCount == 0)
|
||||
continue;
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
ImGui::BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
|
||||
@ -10644,8 +10646,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
||||
return;
|
||||
NodeDrawList(window->DrawList, "DrawList");
|
||||
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
|
||||
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||
ImGui::BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||
if (ImGui::IsItemHovered())
|
||||
GImGui->OverlayDrawList.AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255,255,0,255));
|
||||
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
||||
ImGui::BulletText("Active: %d, Accessed: %d", window->Active, window->Accessed);
|
||||
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
||||
@ -10659,7 +10662,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
Funcs::NodeWindows(g.Windows, "Windows");
|
||||
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size))
|
||||
{
|
||||
for (int i = 0; i < g.RenderDrawLists[0].Size; i++)
|
||||
for (int layer = 0; layer < IM_ARRAYSIZE(g.RenderDrawLists); layer++)
|
||||
for (int i = 0; i < g.RenderDrawLists[layer].Size; i++)
|
||||
Funcs::NodeDrawList(g.RenderDrawLists[0][i], "DrawList");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user