mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Metrics: Changed io.MetricsActiveWindows to reflect the number of active windows (!= from visible windows), which is useful for lazy/idle render mechanisms as new windows are typically not visible for one frame.
Metrics: Added io.MetricsRenderWindow to reflect the number of visible windows.
This commit is contained in:
parent
00e29832d4
commit
bc6ac8b2ae
@ -64,6 +64,9 @@ Other Changes:
|
|||||||
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||||
|
- Metrics: Changed io.MetricsActiveWindows to reflect the number of active windows (!= from visible windows), which is useful
|
||||||
|
for lazy/idle render mechanisms as new windows are typically not visible for one frame.
|
||||||
|
- Metrics: Added io.MetricsRenderWindow to reflect the number of visible windows.
|
||||||
- Demo: Added basic Drag and Drop demo. (#143)
|
- Demo: Added basic Drag and Drop demo. (#143)
|
||||||
- Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section.
|
- Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section.
|
||||||
- Examples: Tweaked the main.cpp of each example.
|
- Examples: Tweaked the main.cpp of each example.
|
||||||
|
12
imgui.cpp
12
imgui.cpp
@ -4356,6 +4356,8 @@ static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* d
|
|||||||
|
|
||||||
static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWindow* window)
|
static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
g.IO.MetricsRenderWindows++;
|
||||||
AddDrawListToDrawData(out_render_list, window->DrawList);
|
AddDrawListToDrawData(out_render_list, window->DrawList);
|
||||||
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
|
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
|
||||||
{
|
{
|
||||||
@ -4368,7 +4370,6 @@ static void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWin
|
|||||||
static void AddWindowToDrawDataSelectLayer(ImGuiWindow* window)
|
static void AddWindowToDrawDataSelectLayer(ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.IO.MetricsActiveWindows++;
|
|
||||||
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
if (window->Flags & ImGuiWindowFlags_Tooltip)
|
||||||
AddWindowToDrawData(&g.DrawDataBuilder.Layers[1], window);
|
AddWindowToDrawData(&g.DrawDataBuilder.Layers[1], window);
|
||||||
else
|
else
|
||||||
@ -4518,6 +4519,7 @@ void ImGui::EndFrame()
|
|||||||
|
|
||||||
IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
|
IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
|
||||||
g.Windows.swap(g.WindowsSortBuffer);
|
g.Windows.swap(g.WindowsSortBuffer);
|
||||||
|
g.IO.MetricsActiveWindows = g.WindowsActiveCount;
|
||||||
|
|
||||||
// Unlock font atlas
|
// Unlock font atlas
|
||||||
g.IO.Fonts->Locked = false;
|
g.IO.Fonts->Locked = false;
|
||||||
@ -4541,7 +4543,7 @@ void ImGui::Render()
|
|||||||
g.FrameCountRendered = g.FrameCount;
|
g.FrameCountRendered = g.FrameCount;
|
||||||
|
|
||||||
// Gather windows to render
|
// Gather windows to render
|
||||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
|
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsRenderWindows = 0;
|
||||||
g.DrawDataBuilder.Clear();
|
g.DrawDataBuilder.Clear();
|
||||||
ImGuiWindow* windows_to_render_front_most[2];
|
ImGuiWindow* windows_to_render_front_most[2];
|
||||||
windows_to_render_front_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
|
windows_to_render_front_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
|
||||||
@ -14037,9 +14039,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
static bool show_draw_cmd_clip_rects = true;
|
static bool show_draw_cmd_clip_rects = true;
|
||||||
static bool show_window_begin_order = false;
|
static bool show_window_begin_order = false;
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui::Text("Dear ImGui %s", ImGui::GetVersion());
|
ImGui::Text("Dear ImGui %s", ImGui::GetVersion());
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||||
ImGui::Text("%d vertices, %d indices (%d triangles)", ImGui::GetIO().MetricsRenderVertices, ImGui::GetIO().MetricsRenderIndices, ImGui::GetIO().MetricsRenderIndices / 3);
|
ImGui::Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
|
||||||
|
ImGui::Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
|
||||||
ImGui::Text("%d allocations", (int)GImAllocatorActiveAllocationsCount);
|
ImGui::Text("%d allocations", (int)GImAllocatorActiveAllocationsCount);
|
||||||
ImGui::Checkbox("Show clipping rectangles when hovering draw commands", &show_draw_cmd_clip_rects);
|
ImGui::Checkbox("Show clipping rectangles when hovering draw commands", &show_draw_cmd_clip_rects);
|
||||||
ImGui::Checkbox("Ctrl shows window begin order", &show_window_begin_order);
|
ImGui::Checkbox("Ctrl shows window begin order", &show_window_begin_order);
|
||||||
|
3
imgui.h
3
imgui.h
@ -1158,7 +1158,8 @@ struct ImGuiIO
|
|||||||
float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames
|
float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames
|
||||||
int MetricsRenderVertices; // Vertices output during last call to Render()
|
int MetricsRenderVertices; // Vertices output during last call to Render()
|
||||||
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
||||||
int MetricsActiveWindows; // Number of visible root windows (exclude child windows)
|
int MetricsRenderWindows; // Number of visible windows
|
||||||
|
int MetricsActiveWindows; // Number of active windows
|
||||||
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
|
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user