本文整理汇总了Python中dispatcher.Dispatcher.process方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatcher.process方法的具体用法?Python Dispatcher.process怎么用?Python Dispatcher.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dispatcher.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.process方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import process [as 别名]
class Main():
def __init__(self, gru_file=None):
self.menu = Menu(self, config, game = None)
self.library = Library(self, config)
self.collider = Collider(self.menu, self.library, game=None)
self.dispatcher = Dispatcher(self.collider, self.library, self.menu, game=None)
self.clock = pygame.time.Clock()
self.fps = Fps(self.clock, config)
if gru_file is not None:
game = Game(gru_file)
self.load(game)
else:
self.game = None
def load(self, game):
self.library.clear()
self.game = game
self.collider.game = game
self.menu.game = game
def clear(self):
self.game = None
self.collider.game = None
self.menu.game = None
def draw(self):
tick = self.clock.get_time()
self.menu.draw()
if self.game == None:
self.library.draw()
else:
self.game.draw(tick)
def start(self):
while 1:
self.clock.tick()
mrect = Rect(mouse.get_pos(), (1,1))
self.collider.check()
self.draw()
self.fps.draw()
for ev in event.get():
self.dispatcher.process(ev)
display.update()