From e6a65d8810eb0631226f69f03e51a9e8a0462e84 Mon Sep 17 00:00:00 2001 From: sercero Date: Tue, 30 Apr 2024 22:13:18 -0300 Subject: [PATCH] Convert metrics to table --- ogre_mesh_viewer.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ogre_mesh_viewer.py b/ogre_mesh_viewer.py index ad47fbc..73374cd 100755 --- a/ogre_mesh_viewer.py +++ b/ogre_mesh_viewer.py @@ -229,11 +229,24 @@ def draw_metrics(self): ImGui.WindowFlags_AlwaysAutoResize | ImGui.WindowFlags_NoSavedSettings | ImGui.WindowFlags_NoFocusOnAppearing | \ ImGui.WindowFlags_NoNav self.show_metrics = ImGui.Begin("Metrics", self.show_metrics, flags)[1] + + stats_dict = { + "FPS": f"{stats.lastFPS:.2f}", + "Average FPS": f"{stats.avgFPS:.2f}", + "Batches": f"{stats.batchCount}", + "Triangles": f"{stats.triangleCount}" + } + ImGui.Text("Metrics") ImGui.Separator() - ImGui.Text(f"Average FPS: {stats.avgFPS:.2f}") - ImGui.Text(f"Batches: {stats.batchCount}") - ImGui.Text(f"Triangles: {stats.triangleCount}") + if ImGui.BeginTable("Metrics", 2): + for stat, value in stats_dict.items(): + ImGui.TableNextRow() + ImGui.TableSetColumnIndex(0) + ImGui.Text(stat) + ImGui.TableSetColumnIndex(1) + ImGui.Text(value) + ImGui.EndTable() ImGui.End() def draw_loading(self):