本文整理汇总了Python中gui.Gui.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.setup方法的具体用法?Python Gui.setup怎么用?Python Gui.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import setup [as 别名]
def main():
# Construct the objects that will run the game.
courier = Courier()
world = World(courier)
gui = Gui(courier, world)
systems = [courier, world, gui]
# Connect to the server and wait until the game is ready to begin.
courier.setup()
courier.login(world.setup)
# Open up a window and get ready to start playing.
clock = pygame.time.Clock()
frequency = 40
gui.setup()
# Play the game!
while world.still_playing():
time = clock.tick(frequency) / 1000
for system in systems:
system.update(time)
# Exit gracefully.
for system in systems:
system.teardown()
示例2: ClientGame
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import setup [as 别名]
class ClientGame (Engine):
""" Plays the game. Does not have any game logic. It send player input to
the server which will eventually tell the client's game what to do. """
# Constructor {{{1
def __init__ (self, loop, forum, world):
print 'C: Begin game engine.'
Engine.__init__ (self, loop)
self.forum = forum
self.world = world
# Set up the relays.
publisher = self.forum.get_publisher()
subscriber = self.forum.get_subscriber()
self.reflex = Reflex(self, subscriber, self.world)
self.player_relay = PlayerRelay(self, publisher, self.world)
self.gui = Gui(self.world, self.player_relay)
def setup (self):
self.reflex.setup()
self.player_relay.setup()
self.gui.setup()
self.forum.lock()
# Update {{{1
def update (self, time):
self.forum.update()
self.reflex.update(time)
self.player_relay.update(time)
self.world.update(time)
self.gui.update(time)
# Methods {{{1
def game_over(self):
# Called by the Reflex?
print 'Game over.'
self.exit_engine()
def successor (self):
self.forum.unlock()
return ClientPostgame(self.loop, self.forum, self.world, self.gui)
def teardown (self):
time.sleep(1)