示例#1
0
        private void DrawPiece(Piece piece)
        {
            var pieceOrigin = PieceOriginInPixels(piece);

            for (int i = 0; i < piece.BlockCount; i++)
            {
                for (int j = 0; j < piece.BlockCount; j++)
                {
                    if (piece.GetBlock(j, i) != PieceBlock.NoBlock)
                    {
                        var blockOriginX = pieceOrigin.X + (j * _display.BlockSizeInPixels());
                        var blockOriginY = pieceOrigin.Y + (i * _display.BlockSizeInPixels());
                        _display.DrawBlock(blockOriginX, blockOriginY, piece.Color);
                    }
                }
            }
        }