本文整理匯總了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()