コード例 #1
0
ファイル: Board.py プロジェクト: kogax/pyqt4-Tetris
    def __init__(self, parent):
        """
		Initializes QFrame.
		Initializes attributes.
		Sets timer.
		"""

        QtGui.QFrame.__init__(self, parent)

        self.timer = QtCore.QBasicTimer()

        # begin: attributes
        self.BoardWidth = 10  # This defines the width of the game board (10 blocks)
        self.BoardHeight = 22  # This defines the height of the game board (22 blocks)
        self.Speed = Config.Speed  # This defines the game's speed (300 milliseconds)
        self.isWaitingAfterLine = False
        self.curPiece = Shape()
        self.nextPiece = Shape()
        self.curX = 0
        self.curY = 0
        self.numLinesRemoved = 0
        self.isStarted = False
        self.isPaused = False
        self.board = []
        # end: attributes

        self.clearBoard()
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.nextPiece.setRandomShape()