MCPcopy Create free account
hub / github.com/clementgallet/libTAS / ShowMetricsWindow

Function ShowMetricsWindow

src/external/imgui/implot.cpp:5227–5435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5225}
5226
5227void ShowMetricsWindow(bool* p_popen) {
5228
5229 static bool show_plot_rects = false;
5230 static bool show_axes_rects = false;
5231 static bool show_axis_rects = false;
5232 static bool show_canvas_rects = false;
5233 static bool show_frame_rects = false;
5234 static bool show_subplot_frame_rects = false;
5235 static bool show_subplot_grid_rects = false;
5236 static bool show_legend_rects = false;
5237
5238 ImDrawList& fg = *ImGui::GetForegroundDrawList();
5239
5240 ImPlotContext& gp = *GImPlot;
5241 // ImGuiContext& g = *GImGui;
5242 ImGuiIO& io = ImGui::GetIO();
5243 ImGui::Begin("ImPlot Metrics", p_popen);
5244 ImGui::Text("ImPlot " IMPLOT_VERSION);
5245 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
5246 ImGui::Text("Mouse Position: [%.0f,%.0f]", io.MousePos.x, io.MousePos.y);
5247 ImGui::Separator();
5248 if (ImGui::TreeNode("Tools")) {
5249 if (ImGui::Button("Bust Plot Cache"))
5250 BustPlotCache();
5251 ImGui::SameLine();
5252 if (ImGui::Button("Bust Item Cache"))
5253 BustItemCache();
5254 ImGui::Checkbox("Show Frame Rects", &show_frame_rects);
5255 ImGui::Checkbox("Show Canvas Rects",&show_canvas_rects);
5256 ImGui::Checkbox("Show Plot Rects", &show_plot_rects);
5257 ImGui::Checkbox("Show Axes Rects", &show_axes_rects);
5258 ImGui::Checkbox("Show Axis Rects", &show_axis_rects);
5259 ImGui::Checkbox("Show Subplot Frame Rects", &show_subplot_frame_rects);
5260 ImGui::Checkbox("Show Subplot Grid Rects", &show_subplot_grid_rects);
5261 ImGui::Checkbox("Show Legend Rects", &show_legend_rects);
5262 ImGui::TreePop();
5263 }
5264 const int n_plots = gp.Plots.GetBufSize();
5265 const int n_subplots = gp.Subplots.GetBufSize();
5266 // render rects
5267 for (int p = 0; p < n_plots; ++p) {
5268 ImPlotPlot* plot = gp.Plots.GetByIndex(p);
5269 if (show_frame_rects)
5270 fg.AddRect(plot->FrameRect.Min, plot->FrameRect.Max, IM_COL32(255,0,255,255));
5271 if (show_canvas_rects)
5272 fg.AddRect(plot->CanvasRect.Min, plot->CanvasRect.Max, IM_COL32(0,255,255,255));
5273 if (show_plot_rects)
5274 fg.AddRect(plot->PlotRect.Min, plot->PlotRect.Max, IM_COL32(255,255,0,255));
5275 if (show_axes_rects)
5276 fg.AddRect(plot->AxesRect.Min, plot->AxesRect.Max, IM_COL32(0,255,128,255));
5277 if (show_axis_rects) {
5278 for (int i = 0; i < ImAxis_COUNT; ++i) {
5279 if (plot->Axes[i].Enabled)
5280 fg.AddRect(plot->Axes[i].HoverRect.Min, plot->Axes[i].HoverRect.Max, IM_COL32(0,255,0,255));
5281 }
5282 }
5283 if (show_legend_rects && plot->Items.GetLegendCount() > 0) {
5284 fg.AddRect(plot->Items.Legend.Rect.Min, plot->Items.Legend.Rect.Max, IM_COL32(255,192,0,255));

Callers 1

ShowDemoWindowMethod · 0.85

Calls 15

GetForegroundDrawListFunction · 0.85
BustPlotCacheFunction · 0.85
BustItemCacheFunction · 0.85
ImFormatStringFunction · 0.85
ShowAxisMetricsFunction · 0.85
ColormapSliderFunction · 0.85
PushStyleColorFunction · 0.85
ImVec4Class · 0.85
PushStyleVarFunction · 0.85
ImVec2Function · 0.85
PopStyleVarFunction · 0.85
PopStyleColorFunction · 0.85

Tested by

no test coverage detected