MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / ShowMetricsWindow

Function ShowMetricsWindow

Source/3rdParty/implot/implot.cpp:5303–5511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5301}
5302
5303void ShowMetricsWindow(bool* p_popen) {
5304
5305 static bool show_plot_rects = false;
5306 static bool show_axes_rects = false;
5307 static bool show_axis_rects = false;
5308 static bool show_canvas_rects = false;
5309 static bool show_frame_rects = false;
5310 static bool show_subplot_frame_rects = false;
5311 static bool show_subplot_grid_rects = false;
5312 static bool show_legend_rects = false;
5313
5314 ImDrawList& fg = *ImGui::GetForegroundDrawList();
5315
5316 ImPlotContext& gp = *GImPlot;
5317 // ImGuiContext& g = *GImGui;
5318 ImGuiIO& io = ImGui::GetIO();
5319 ImGui::Begin("ImPlot Metrics", p_popen);
5320 ImGui::Text("ImPlot " IMPLOT_VERSION);
5321 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
5322 ImGui::Text("Mouse Position: [%.0f,%.0f]", io.MousePos.x, io.MousePos.y);
5323 ImGui::Separator();
5324 if (ImGui::TreeNode("Tools")) {
5325 if (ImGui::Button("Bust Plot Cache"))
5326 BustPlotCache();
5327 ImGui::SameLine();
5328 if (ImGui::Button("Bust Item Cache"))
5329 BustItemCache();
5330 ImGui::Checkbox("Show Frame Rects", &show_frame_rects);
5331 ImGui::Checkbox("Show Canvas Rects",&show_canvas_rects);
5332 ImGui::Checkbox("Show Plot Rects", &show_plot_rects);
5333 ImGui::Checkbox("Show Axes Rects", &show_axes_rects);
5334 ImGui::Checkbox("Show Axis Rects", &show_axis_rects);
5335 ImGui::Checkbox("Show Subplot Frame Rects", &show_subplot_frame_rects);
5336 ImGui::Checkbox("Show Subplot Grid Rects", &show_subplot_grid_rects);
5337 ImGui::Checkbox("Show Legend Rects", &show_legend_rects);
5338 ImGui::TreePop();
5339 }
5340 const int n_plots = gp.Plots.GetBufSize();
5341 const int n_subplots = gp.Subplots.GetBufSize();
5342 // render rects
5343 for (int p = 0; p < n_plots; ++p) {
5344 ImPlotPlot* plot = gp.Plots.GetByIndex(p);
5345 if (show_frame_rects)
5346 fg.AddRect(plot->FrameRect.Min, plot->FrameRect.Max, IM_COL32(255,0,255,255));
5347 if (show_canvas_rects)
5348 fg.AddRect(plot->CanvasRect.Min, plot->CanvasRect.Max, IM_COL32(0,255,255,255));
5349 if (show_plot_rects)
5350 fg.AddRect(plot->PlotRect.Min, plot->PlotRect.Max, IM_COL32(255,255,0,255));
5351 if (show_axes_rects)
5352 fg.AddRect(plot->AxesRect.Min, plot->AxesRect.Max, IM_COL32(0,255,128,255));
5353 if (show_axis_rects) {
5354 for (int i = 0; i < ImAxis_COUNT; ++i) {
5355 if (plot->Axes[i].Enabled)
5356 fg.AddRect(plot->Axes[i].HoverRect.Min, plot->Axes[i].HoverRect.Max, IM_COL32(0,255,0,255));
5357 }
5358 }
5359 if (show_legend_rects && plot->Items.GetLegendCount() > 0) {
5360 fg.AddRect(plot->Items.Legend.Rect.Min, plot->Items.Legend.Rect.Max, IM_COL32(255,192,0,255));

Callers 2

ShowDemoWindowMethod · 0.85
ShowDemoWindowFunction · 0.85

Calls 15

GetForegroundDrawListFunction · 0.85
SeparatorFunction · 0.85
BustPlotCacheFunction · 0.85
BustItemCacheFunction · 0.85
CheckboxFunction · 0.85
PushIDFunction · 0.85
ColorEdit4Function · 0.85
BulletTextFunction · 0.85
GetMarkerNameFunction · 0.85
ImFormatStringFunction · 0.85
ShowAxisMetricsFunction · 0.85
ColormapSliderFunction · 0.85

Tested by

no test coverage detected