Commits

rkruppe committed a81ac0c

Remove some more cruft from demo.py

Comments (0)

Files changed (1)

 from ttgx.model import gamestate
 from ttgx.meta import from_yaml
 
-log = logging.getLogger('ttg-demo')
-draw_count = 0
+log = logging.getLogger('ttgx-demo')
 
 
 def init():
     driver.switch(gsc.gameset.start_page)
 
 
-#XXX FPS and CPU time is incredibly high (>90% CPU, usually thousands of FPS,
-# sometimes tens of thousands).
-# Somehow, pyglet sucks at sleep()ing or doesn't even try.
-# Despite the docs praising the built-in event loop as less CPU-hungry,
-# it does as many updates as it can, so the end result is just as CPU-hungry.
-# (Though to be fair, it may avoid busy waits in some places and just use the
-#  free time for other drawing.)
-#TODO: dive into pyglet.event.EventLoop and come up with a better idle() that
-# respects FPS limits
-
-
-def run():
-    start_time = datetime.datetime.now()
-    pyglet.app.run()
-    end_time = datetime.datetime.now()
-    dt = end_time - start_time
-    pseudo_fps = draw_count / dt.total_seconds()
-    log.info(
-        "%d draw() calls in %.2f seconds => %.2f FPS",
-        draw_count, dt.total_seconds(), pseudo_fps
-    )
-
-
 def exit(gsc):
     if gsc.game_active:
         try:
         log.error('Initialization failed:', exc_info=True)
         sys.exit(3)
     init_display(gsc)
-    run()
+    pyglet.app.run()
     exit(gsc)
 
 if __name__ == '__main__':