本文整理汇总了Python中gui.Gui.render方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.render方法的具体用法?Python Gui.render怎么用?Python Gui.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import render [as 别名]
def main(numFrames = -1):
Constants.radius = 10.0
Constants.numObstacles = 7
Constants.numCharacters = 5
Constants.worldDim = (512, 512)
Constants.npcNames = ["Alice", "Bob", "Carol", "Dave"]
# cflewis | 2008-11-02 | It would be nice to have a different colour,
# but PyGame was only rendering this subset. Pretty annoying.
Constants.npcColors = ["green", "red", "orange", "#ff00ff"]
Constants.pcColorName = "blue"
Constants.flashColorName = "white"
Constants.backgroundName = "black"
Constants.obstacleColorName = "white"
commentator = Commentator()
gs = commentator.get_observed_game_state(GameState(Constants.worldDim))
gui = Gui(gs, Constants.backgroundName)
sim = Simulator(gs)
kb = Keyboard()
setupCharacters(gs, gui, kb)
setupObstacles(gs, gui)
clock = pygame.time.Clock()
while True:
gui.render(gs)
gs.incFrame()
kb.processEvents()
if kb.quit:
break
if 0 <= numFrames and numFrames <= gs.frame:
break
deltaT = clock.tick(30)/1000.0
sim.forward(deltaT)
gui.destroyWindow()