def draw(self):
     self.fieldMutex.acquire()
     if self.currentPlayer is None:
         if not self.player1.isComputer and self.player2.isComputer:
             self._changePlayerTurn = self._changePlayerTurnArray[1]
         elif not self.player1.isComputer and not self.player2.isComputer:
             self._changePlayerTurn = self._changePlayerTurnArray[0]
         else:
             self._changePlayerTurn = self._changePlayerTurnArray[2]
             self.aiDelay = 0.005
             self.lockdownTime = 0.005
         self._changePlayerTurn()
     if self.currentPlayer.isComputer and not self.currentPlayer.isPlaying:
         self.currentPlayer.play(self)
     self.header.draw()
     for y in range(0, len(self.playFields)):
         for x in range(0, len(self.playFields[y])):
             field = self.playFields[y][x]
             if (field.barrier):
                 glColor3f(1, 0, 0)
             elif (self.firstSelected is field):
                 glColor3f(1, 0, 1)
             elif (field.piece is not None):
                 if (field.piece.owner is self.player1):
                     glColor3f(1, 1, 0)
                 elif (field.piece.owner is self.player2):
                     glColor3f(0, 1, 0)
             else: 
                 glColor3f(1, 1, 1)                
             Utils.drawField(field)
     self.fieldMutex.release()
    def draw(self):
        if self.player.isComputer:
            self.player.setuppieces(self.bottomArea,self.topArea)
            self.isDone = True
        if self.isDone:
            fields = self.topArea + self.bottomArea
            if self is self.window.setupScreenP2:
                for y in range(6,10):
                    for x in range(0,10):
                        self.window.playScreen.playFields[y][x].piece = self.topArea[9-y][9-x].piece
                self.window.currentScreen = self.window.playScreen
            else: 
                for y in range(0,4):
                    for x in range (0,10):
                        self.window.playScreen.playFields[y][x].piece = self.topArea[y][x].piece
                self.window.currentScreen = self.window.setupScreenP2
        else:
            self.header.draw()
            self.footer.draw()

            for area in [self.bottomArea, self.topArea]:
                for y in range(0, len(area)):
                    for field in area[y]:         
                        if (field is self.firstSelected):
                            glColor3f(1, 0, 1)
                        else:
                            glColor3f(1, 1, 1)

                        Utils.drawField(field)

                for field in self.barriers:
                    glColor3f(1, 0, 0)
                    Utils.drawField(field)

            glColor3f(1, 1, 1)
            if self.buttons[0].selected:
                self.buttons[0].selected = False
                if  not self.checkIfDone():
                    self.footer.text = "You have to place all your pieces before you can continue"
                    # Reset footer text to original after x seconds
                    if hasattr(self, 'textResetTimer') and self.textResetTimer.isAlive():
                        self.textResetTimer.cancel()
                        self.textResetTimer.join()
                    self.textResetTimer = threading.Timer(3, self.resetBottomText)
                    self.textResetTimer.start()
                else:
                    self.isDone = True
            if self.buttons[1].selected:
                self.autofill()
                self.buttons[1].selected = False
            for button in self.buttons:
                Utils.drawButton(button)