示例#1
0
文件: game.py 项目: tailhook/pyzza
 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)
示例#2
0
文件: game.py 项目: tailhook/pyzza
 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)