From 8bb669d6b2b31aa9e1be21c91b229cc143668735 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 25 Jun 2025 00:11:28 -0500 Subject: [PATCH] Add cell count display to sprint debug info in HUD --- core/simulation_engine.py | 3 ++- ui/hud.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/simulation_engine.py b/core/simulation_engine.py index e9ef2a7..0095dcb 100644 --- a/core/simulation_engine.py +++ b/core/simulation_engine.py @@ -163,7 +163,8 @@ class SimulationEngine: self.last_tps_time = time.perf_counter() self.screen.fill(BLACK) self.renderer.clear_screen() - self.hud.render_sprint_debug(self.screen, self.actual_tps, self.total_ticks) + cell_count = self._count_cells() + self.hud.render_sprint_debug(self.screen, self.actual_tps, self.total_ticks, cell_count) pygame.display.flip() self.clock.tick(MAX_FPS) diff --git a/ui/hud.py b/ui/hud.py index 78bda6b..53757b8 100644 --- a/ui/hud.py +++ b/ui/hud.py @@ -641,17 +641,20 @@ class HUD: screen.blit(surf, (tooltip_rect.left + TOOLTIP_PADDING_X, y)) y += surf.get_height() + TOOLTIP_LINE_SPACING - def render_sprint_debug(self, screen, actual_tps, total_ticks): + def render_sprint_debug(self, screen, actual_tps, total_ticks, cell_count=None): """Render sprint debug info: header, TPS, and tick count.""" header = self.font.render("Sprinting...", True, (255, 200, 0)) tps_text = self.font.render(f"TPS: {actual_tps}", True, (255, 255, 255)) ticks_text = self.font.render(f"Ticks: {total_ticks}", True, (255, 255, 255)) + cell_text = self.font.render(f"Cells: {cell_count}" if cell_count is not None else "Cells: N/A", True, (255, 255, 255)) - y = self.screen_height // 2 - 40 + y = self.screen_height // 2 - 80 header_rect = header.get_rect(center=(self.screen_width // 2, y)) tps_rect = tps_text.get_rect(center=(self.screen_width // 2, y + 40)) ticks_rect = ticks_text.get_rect(center=(self.screen_width // 2, y + 80)) + cell_rect = cell_text.get_rect(center=(self.screen_width // 2, y + 120)) screen.blit(header, header_rect) screen.blit(tps_text, tps_rect) screen.blit(ticks_text, ticks_rect) + screen.blit(cell_text, cell_rect)