def __init__(self): signal.signal(signal.SIGINT, self.signal_handler) # ^C signal.signal(signal.SIGTERM, self.signal_handler) # process termination self.config = Config() self.display = Display(self.config) self.game_logic = GameLogic(self.config) self.goOn = True
def demarrer(self): self.gameLogic = GameLogic(self) #Commenter/décommenter la ligne de votre choix pour démarrer le jeu #Démarre dans le menu # self.menuPrincipal = InterfaceMenuPrincipal() #Démarre directement dans le jeu # messenger.send("DemarrerPartie") #Démarrer directement le menu de cartes messenger.send("DemarrerMenuNiveau")
def demarrer(self): self.gameLogic = GameLogic(self) #Commenter/décommenter la ligne de votre choix pour démarrer le jeu #Démarre dans le menu self.menuChoixNiveaux = InterfaceMenuChoixNiveau() self.menuAuthentification = InterfaceMenuAuthentification( self.unDTOUsers) self.menuPrincipal = InterfaceMenuPrincipal(self.textConnexion)
class Tetris: def __init__(self): signal.signal(signal.SIGINT, self.signal_handler) # ^C signal.signal(signal.SIGTERM, self.signal_handler) # process termination self.config = Config() self.display = Display(self.config) self.game_logic = GameLogic(self.config) self.goOn = True def run(self): self.display.run() while self.goOn: time_A = time.time() input_key = self.display.get_input_key() if input_key == 113: # quit self.goOn = False try: self.display.update_grid(self.game_logic.do_logic(input_key)) self.display.update_score(self.game_logic.get_score()) except Exception as e: if str(e).strip() == "Initial collision": self.game_logic.set_game_ended(True) self.display.set_game_ended(True) else: traceback.print_exc() time_B = time.time() time.sleep(self.config.refresh_rate - (time_B - time_A)) self.display.quit() def signal_handler(self, sig, frame): """A custom signal handler to stop the game""" print("Got Signal: %s " % sig) if sig == signal.SIGINT or sig == signal.SIGTERM: self.goOn = False
def demarrer(self): self.gameLogic = GameLogic(self) #Commenter/décommenter la ligne de votre choix pour démarrer le jeu #Démarre dans le menu self.menuPrincipal = InterfaceMenuPrincipal()
frameCapture = FrameCapturer.FrameCapturer( int(settings.getValue("camID")), settings.getValue("shapeCoordinates1"), settings.getValue("shapeCoordinates2")) imgHandler = ImageHandler.ImageHandler( bool(settings.getValue("multiThreading")), frameCapture, [ball, basket, blackLine], settings.getValue("minImgArea"), socketData) ref = RefereeHandler.RefereeHandler(robotID, fieldID, mb) thrower = Thrower.Thrower(mb) game = GameLogic.GameLogic(move, settings.getValue("deltaFromMidPoint"), settings.getValue("driveSpeed"), settings.getValue("turnSpeed"), frameCapture, socketData, ref, fieldID, robotID, mb, ball, basket, settings.getValue("defaultGameState"), thrower, blackLine) socketHandler = SocketHandler.SocketHandler(socketData, ball, basket, 0, frameCapture, blackLine) timer = Timer.Timer() t = threading.Thread(target=socketHandler.initServ) t.start() imgHandlerThread = threading.Thread(target=imgHandler.run) imgHandlerThread.start()