当前位置: 首页>>代码示例>>Python>>正文


Python Gui.render方法代码示例

本文整理汇总了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()
开发者ID:cflewis,项目名称:aspect-oriented-commentator,代码行数:44,代码来源:tag.py


注:本文中的gui.Gui.render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。