Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added an fps debug output.

  • Loading branch information...
commit b100059214d9d5cf47a3e160a155893341a9177c 1 parent c10a392
namaste authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 soylent/weapon/Main.py
View
9 soylent/weapon/Main.py
@@ -53,6 +53,8 @@ def __init__(self):
def MainLoop(self):
+ frames = 0
+ ticks = pygame.time.get_ticks()
while 1:
self.EventHandler()
self.hero.Update()
@@ -60,7 +62,12 @@ def MainLoop(self):
e.Update()
self.CheckCollisions()
self.DrawAll()
- pygame.time.wait(25)
+ pygame.time.wait(10)
+ frames = frames + 1
+ if pygame.time.get_ticks() - ticks > 1000:
+ print "fps: %d" % ((frames*1000)/(pygame.time.get_ticks()-ticks))
+ frames = 0
+ ticks = pygame.time.get_ticks()
def DrawAll(self):
self.world.blit(self.background, (0, 0))
Please sign in to comment.
Something went wrong with that request. Please try again.