Permalink
Browse files

Added an fps debug output.

  • Loading branch information...
1 parent c10a392 commit b100059214d9d5cf47a3e160a155893341a9177c namaste committed Apr 1, 2008
Showing with 8 additions and 1 deletion.
  1. +8 −1 soylent/weapon/Main.py
View
@@ -53,14 +53,21 @@ def __init__(self):
def MainLoop(self):
+ frames = 0
+ ticks = pygame.time.get_ticks()
while 1:
self.EventHandler()
self.hero.Update()
for e in self.enemy_sprites:
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))

0 comments on commit b100059

Please sign in to comment.