def stop(self): """ Stops the game client.""" if self.__verbose: log.info("[BOOMBOOM] Stopping client...") Happyboom.stop(self) self.launchEvent("happyboom", "disconnection", self._io, u"Quit.") self.display.stop()
def __init__(self, args): """ BoomBoomClient constructor. @param host: Server hostname. @type host: C{str} @param display_port: Server port for "display"/"view" connection. @type display_port: C{int} @param input_port: Server port for "input" connection. @type input_port: C{int} @param verbose: Verbose mode flag. @type verbose: C{bool} @param debug: Debug mode flag. @type debug: C{bool} @param max_fps: Maximal number of frames per second, for optimization. @type max_fps: C{int} """ args["protocol"] = protocol.loadProtocol("protocol.xml") args["features"] = ["game"] # Constant features Happyboom.__init__(self, args) EventListener.__init__(self, prefix="evt_") self.display = Display(args) self.input = Input(args) self.__verbose = args.get("verbose", False) self.registerEvent("happyboom") self.registerEvent("game")
def start(self): """ Starts the game client.""" if self.__verbose: log.info("[BOOMBOOM] Starting client...") Happyboom.start(self) # Create thread for display thread.start_new_thread(self.displayThread, ()) quit = False while not quit: self.input.process() time.sleep(0.100) quit = self.stopped