當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。