本文整理汇总了Python中Engine.Engine.get_updates方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.get_updates方法的具体用法?Python Engine.get_updates怎么用?Python Engine.get_updates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine.Engine
的用法示例。
在下文中一共展示了Engine.get_updates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import get_updates [as 别名]
class Program:
"""
General program template
- init function for program component initialization
- main loop
* check events -> handle (event)
* update
"""
def __init__(self):
"""
init function
"""
self.interface = Interface()
self.engine = Engine()
self.run()
def run(self):
"""
main loop
"""
while True:
self.check_events()
self.update()
def check_events(self):
"""
pygame event handling (edit this for more events)
"""
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
mousex, mousey = event.pos
response = self.interface.click(mousex,mousey)
self.handle(response)
def handle(self,response):
"""
handle responses to events
"""
self.engine.send(response)
def update(self):
"""
update state of program components
"""
self.engine.update()
self.interface.update(self.engine.get_updates())