/* * Renders the board by drawing the tetromino and * the board. */ private void RenderBoard() { // draw the board for (int x = 0; x < WindowWidth; ++x) { for (int y = 0; y < WindowHeight; ++y) { RenderedBoard[x, y] = Board.GetSquare(x, y); } } // put tetromino on top of it int tx = Board.TetrominoX; int ty = Board.TetrominoY; Tetromino t = Board.FallingTetromino; if (t == null) { return; } for (int x = 0; x < Tetromino.TETROMINO_WIDTH; ++x) { for (int y = 0; y < Tetromino.TETROMINO_WIDTH; ++y) { SquareType square = t.GetSquare(x, y); if (square != SquareType.EMPTY) { RenderedBoard[x + tx, y + ty] = t.GetSquare(x, y); } } } }
static void SpawnTetromino() { if (tetromino.locked) { tetromino = nextTetromino; nextTetromino = new Tetromino(); nextTetromino.DrawNext(); } }