Exemplo n.º 1
0
class Game(Root):
    """Main class

    """
    live = True
    config = Config()

    def __init__(self, cheat_enable = True):
        Root.__init__(self)

        self.cheat_enable = cheat_enable
        signal.signal(signal.SIGINT, self.signal_stop)
        signal.signal(signal.SIGTERM, self.signal_stop)

        self.process = GUI(self)
        self.world = World(self.process, self)
        self.child_game = ChildMain(self)

    def write(self, info):
        self.child_game.write(info)

    def start(self):
        self.process.start()

    def stop(self):
        self.live = False
        self.process.write('Good bye')
        os._exit(0)

    def signal_stop(self, signum, frame):
        self.stop()
Exemplo n.º 2
0
    def __init__(self, cheat_enable = True):
        Root.__init__(self)

        self.cheat_enable = cheat_enable
        signal.signal(signal.SIGINT, self.signal_stop)
        signal.signal(signal.SIGTERM, self.signal_stop)

        self.process = GUI(self)
        self.world = World(self.process, self)
        self.child_game = ChildMain(self)