Exemplo n.º 1
0
 public void Draw(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < G.FieldWidth; i++)
     {
         for (int j = 0; j < G.FieldHeight; j++)
         {
             Tetromino.DrawTetro(spriteBatch, tetroTexture, (Tetromino_Type)l_field[i, j], i, j);
         }
     }
     DrawGhost(spriteBatch);
     TetrominoQueue.ElementAt(0).Draw(spriteBatch, tetroTexture, currentX, currentY, rotation);
     TetrominoQueue.ElementAt(1).Draw(spriteBatch, tetroTexture, 12, 0, 0);
     TetrominoQueue.ElementAt(2).Draw(spriteBatch, tetroTexture, 17, 0, 0);
     TetrominoQueue.ElementAt(3).Draw(spriteBatch, tetroTexture, 22, 0, 0);
     if (heldTetromino != null)
     {
         heldTetromino.Draw(spriteBatch, tetroTexture, 12, 5, 0);
     }
 }
Exemplo n.º 2
0
        private void DrawGhost(SpriteBatch spriteBatch)
        {
            Tetromino hTetromino = new Tetromino(TetrominoQueue.ElementAt(0))
            {
                tetroType = Tetromino_Type.Hh
            };

            for (int y = currentY; y < G.FieldHeight; y++)
            {
                if (CheckTetromino(hTetromino, currentX, y))
                {
                    if (y == currentY)
                    {
                        break;
                    }
                    hTetromino.Draw(spriteBatch, tetroTexture, currentX, y, rotation);
                    break;
                }
            }
        }