Ejemplo n.º 1
0
 def frame(self, ev):
     nt = getTimer()
     delta = (nt - self.lastframe)*0.001
     for fun in values(self.handlers):
         fun(delta)
     self.lastframe = nt
     if self.show_fps:
         self.fps.text = 'fps: ' + (1/delta).toFixed(2)
Ejemplo n.º 2
0
 def start(self, sprite, show_fps=False):
     self.sprite = sprite
     self.lastframe = getTimer()
     self.handlers = []
     sprite.addEventListener(Event.ENTER_FRAME, self.frame)
     self.show_fps = show_fps
     if show_fps:
         self.fps = TextField()
         sprite.addChild(self.fps)