Beispiel #1
0
 public void Draw(int x, int y, Tetromino data, int orientation, char chr = '█')
 {
     //
     Draw(x, y, data.Width, data.Height, (int xc, int yc, out ConsoleColor color) =>
     {
         color = data.Color;
         return(data.IsSolid(xc, yc, orientation));
     }, chr);
 }
Beispiel #2
0
 private IEnumerable <IntVec2> GetPieceFieldCoordinates()
 {
     for (var x = 0; x < UserPiece.Width; x++)
     {
         for (var y = UserPiece.Height; y >= 0; y--)
         {
             // If a valid block in the piece
             if (UserPiece.IsSolid(x, y, Rotation))
             {
                 // Yield coordinate
                 yield return(new IntVec2(X + x, Y + y));
             }
         }
     }
 }
Beispiel #3
0
        public void DrawPreview(int x, int y, Tetromino data, char chr = '█')
        {
            // Computes offset to 'center' the preview
            var xShift = 4 - data.Width;
            var yShift = data.Width == 4 ? 0 : 1;

            //
            // _app.DrawBorder(x - 1, y - 1, 1 + 4 * 2, 1 + 4, BorderKind.Thin);

            //
            Draw(xShift + x, yShift + y, 4, 4, (int xc, int yc, out ConsoleColor color) =>
            {
                color = data.Color;
                return(data.IsSolid(xc, yc, 0));
            }, chr);
        }