Add cell count display to sprint debug info in HUD

This commit is contained in:
Sam 2025-06-25 00:11:28 -05:00
parent d0f01c0a48
commit 8bb669d6b2
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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)