本文整理汇总了Python中Timer.get_frame_time方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.get_frame_time方法的具体用法?Python Timer.get_frame_time怎么用?Python Timer.get_frame_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer.get_frame_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __drawScene
# 需要导入模块: import Timer [as 别名]
# 或者: from Timer import get_frame_time [as 别名]
def __drawScene(self):
self.screen.fill((0, 0, 0))
for star in Stars():
self.screen.set_at(star, (200, 200, 200))
self.sprites.draw(self.screen)
self.particles.draw(self.screen)
render_text(self.screen, "Score: %06d" % self.score, self.font, (10, 10))
render_text(self.screen, "High: %06d" % self.highscore, self.font, (SCREEN_WIDTH/2, 10),True)
render_text(self.screen, "Level: %d" % self.num_level, self.font, (SCREEN_WIDTH-140, 10))
if (self.display_fps):
render_text(self.screen, "FPS: %d" % (1000/Timer.get_frame_time()), self.font, (SCREEN_WIDTH-140, 50))
for i in range(self.lives):
LifeImage(self.screen, (20 + i*20, 50))
if self.state==STATE_END_GAME:
render_text(self.screen, self.text_end_game[0], self.font2, (SCREEN_WIDTH/2, SCREEN_HEIGHT/2-40), True)
i=1
while i<len(self.text_end_game):
render_text(self.screen, self.text_end_game[i], self.font3, (SCREEN_WIDTH/2, SCREEN_HEIGHT/2+self.font3.get_height()*i), True)
i+=1
if self.state==STATE_MAIN and self.timerManager.get_timer(STATE_TIMER)<1000:
render_text(self.screen, "Level "+str(self.num_level+1), self.font2, (SCREEN_WIDTH/2, SCREEN_HEIGHT/3), True)
pygame.display.flip()