Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding DISPLAY_FPS for debugging.

  • Loading branch information...
commit 5cdd7f00e457f85d54e465231f3cec86e4a412f3 1 parent 3603a9e
@asweigart authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 square-shooter/square-shooter_makeover.py
View
9 square-shooter/square-shooter_makeover.py
@@ -32,6 +32,8 @@
SILVER = (204, 204, 204)
WHITE = (255, 255, 255)
+DISPLAY_FPS = False
+
WINDOW_WIDTH = 640
WINDOW_HEIGHT = 480
@@ -524,6 +526,10 @@ def render(self):
text = self.hud_font.render(str(self.world.score), False, BLACK)
self.screen.blit(text, (MAP_WIDTH + 20, 48 * 5))
+ if DISPLAY_FPS:
+ fps_text = self.msg_font.render(str(self.fps), False, GREEN)
+ self.screen.blit(fps_text, (0, 0))
+
pygame.display.flip()
def render_background(self, level):
@@ -603,7 +609,8 @@ def render_pause_text(self):
running = True
while running:
delta_t = clock.tick(60)
- #renderer.fps = int(round(clock.get_fps()))
+ if DISPLAY_FPS:
+ renderer.fps = int(round(clock.get_fps()))
ev = pygame.event.poll()
if ev.type == pygame.QUIT:
Please sign in to comment.
Something went wrong with that request. Please try again.