コード例 #1
0
    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
コード例 #2
0
 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")
コード例 #3
0
ファイル: main.py プロジェクト: PlumpMath/Tankem
    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)
コード例 #4
0
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
コード例 #5
0
ファイル: main.py プロジェクト: Hoanui95/PortFolio
 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()
コード例 #6
0
ファイル: RXmain.py プロジェクト: rsoome/Digi6RX2017
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()