Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding DISPLAY_FPS for debugging.

  • Loading branch information...
commit 5cdd7f00e457f85d54e465231f3cec86e4a412f3 1 parent 3603a9e
Al Sweigart authored August 10, 2012
9  square-shooter/square-shooter_makeover.py
@@ -32,6 +32,8 @@
32 32
 SILVER = (204, 204, 204)
33 33
 WHITE  = (255, 255, 255)
34 34
 
  35
+DISPLAY_FPS = False
  36
+
35 37
 WINDOW_WIDTH = 640
36 38
 WINDOW_HEIGHT = 480
37 39
 
@@ -524,6 +526,10 @@ def render(self):
524 526
         text = self.hud_font.render(str(self.world.score), False, BLACK)
525 527
         self.screen.blit(text, (MAP_WIDTH + 20, 48 * 5))
526 528
 
  529
+        if DISPLAY_FPS:
  530
+            fps_text = self.msg_font.render(str(self.fps), False, GREEN)
  531
+            self.screen.blit(fps_text, (0, 0))
  532
+
527 533
         pygame.display.flip()
528 534
 
529 535
     def render_background(self, level):
@@ -603,7 +609,8 @@ def render_pause_text(self):
603 609
 running = True
604 610
 while running:
605 611
     delta_t = clock.tick(60)
606  
-    #renderer.fps = int(round(clock.get_fps()))
  612
+    if DISPLAY_FPS:
  613
+        renderer.fps = int(round(clock.get_fps()))
607 614
 
608 615
     ev = pygame.event.poll()
609 616
     if ev.type == pygame.QUIT:

0 notes on commit 5cdd7f0

Please sign in to comment.
Something went wrong with that request. Please try again.