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


Python Engine.quit方法代码示例

本文整理汇总了Python中Engine.Engine.quit方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.quit方法的具体用法?Python Engine.quit怎么用?Python Engine.quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine.Engine的用法示例。


在下文中一共展示了Engine.quit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: restart

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import quit [as 别名]
 def restart(self):
     """Restart the game."""
     if not self.restartRequested:
         self.restartRequested = True
         self.input.broadcastSystemEvent("restartRequested")
     else:
             # evilynux - With self.audio.close(), calling self.quit() results in
             #            a crash. Calling the parent directly as a workaround.
         Engine.quit(self)
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:11,代码来源:GameEngine.py

示例2: ResourceTest

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import quit [as 别名]
class ResourceTest(unittest.TestCase):
  def testAsynchLoad(self):
    self.r = Resource()
    self.e.addTask(self.r, synchronized = False)

    self.r.load(self, "result", lambda: loader())

    while not self.result:
      self.e.run()
    
    assert self.result == 0xdada
     
  def testSynchLoad(self):
    self.r = Resource()
    self.e.addTask(self.r, synchronized = False)

    assert self.r.load(self, "result2", loader, synch = True) == 0xdada
    assert self.result2 == 0xdada

  def testAsynchLoadSeries(self):
    self.r = Resource()
    self.e.addTask(self.r, synchronized = False)

    for i in range(10):
      self.r.load(self, "result%d" % i, loader)

    while not self.result9:
      self.e.run()

    assert self.result9 == 0xdada
     
  def testCallback(self):
    self.r = Resource()
    self.e.addTask(self.r, synchronized = False)
    
    self.quux = None
    def loaded(r):
      self.quux = r
    
    self.r.load(self, "fuuba", loader, onLoad = loaded).join()
    
    while not self.fuuba:
      self.e.run()
    
    assert self.fuuba == self.quux
     
  def setUp(self):
    Config.load(Version.appName() + ".ini", setAsDefault = True)
    # Resource expects game_priority to be an integer,
    # Config won't know unless we define it as such.
    Config.define("performance", "game_priority", int, 2)
    self.e = Engine()
    
  def tearDown(self):
    self.e.quit()
开发者ID:Gamer125,项目名称:fofix,代码行数:57,代码来源:ResourceTest.py

示例3: ResourceTest

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import quit [as 别名]
class ResourceTest(unittest.TestCase):
    def testAsynchLoad(self):
        self.r = Resource()
        self.e.addTask(self.r, synchronized = False)

        self.r.load(self, "result", lambda: loader())

        while not self.result:
            self.e.run()

        assert self.result == 0xdada

    def testSynchLoad(self):
        self.r = Resource()
        self.e.addTask(self.r, synchronized = False)

        assert self.r.load(self, "result2", loader, synch = True) == 0xdada
        assert self.result2 == 0xdada

    def testAsynchLoadSeries(self):
        self.r = Resource()
        self.e.addTask(self.r, synchronized = False)

        for i in range(10):
            self.r.load(self, "result%d" % i, loader)

        while not self.result9:
            self.e.run()

        assert self.result9 == 0xdada

    def testCallback(self):
        self.r = Resource()
        self.e.addTask(self.r, synchronized = False)

        self.quux = None
        def loaded(r):
            self.quux = r

        self.r.load(self, "fuuba", loader, onLoad = loaded).join()

        while not self.fuuba:
            self.e.run()

        assert self.fuuba == self.quux

    def setUp(self):
        self.e = Engine()

    def tearDown(self):
        self.e.quit()
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:53,代码来源:ResourceTest.py

示例4: quit

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import quit [as 别名]
 def quit(self):
     self.audio.close()
     Engine.quit(self)
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:5,代码来源:GameEngine.py


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