Example #1
0
        private static void Draw(IConsoleBuffer border, IConsoleBuffer board, IConsoleBuffer nextPiecePanel, IConsoleBuffer scorePanel, string lastCommand)
        {
            frame.Fill(ConsoleColor.DarkGray);

            for (var i = 0; i < PADDING; ++i)
            {
                var j = 2 * i;
                border.Stroke(
                    i, i,
                    border.Width - j, border.Height - j,
                    DoubleLight,
                    ConsoleColor.Gray);
            }

            board.Fill(ConsoleColor.Black);
            board.DrawPuzzle(0, 0, game);
            board.DrawPuzzle(game.CursorX, game.CursorY, game.Current);

            nextPiecePanel.Draw(0, 0, "Next", ConsoleColor.Black);
            nextPiecePanel.DrawPuzzle(2, 1, game.Next);

            var score = game.Score.ToString(CultureInfo.CurrentCulture);

            scorePanel.Draw(0, 0, $"Score", ConsoleColor.Black);
            scorePanel.Draw(2, 1, score, ConsoleColor.White);
            scorePanel.Draw(0, 2, lastCommand, ConsoleColor.Black);

            frame.Flush();
        }
Example #2
0
        public static void Stroke(this IConsoleBuffer buffer, int x, int y, int width, int height, BoxDrawingSet set, ConsoleColor f)
        {
            if (buffer is null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            buffer.Stroke(x, y, width, height, set, f, buffer.GetBackgroundColor(x, y));
        }
Example #3
0
        public static void Stroke(this IConsoleBuffer buffer, int x, int y, int width, int height, BoxDrawingSet set, ConsoleColor f, ConsoleColor b)
        {
            if (set is null)
            {
                throw new ArgumentNullException(nameof(set));
            }

            buffer.Stroke(x, y, width, height, set.Vertical, set.Horizontal, set.UpperLeft, set.UpperRight, set.LowerLeft, set.LowerRight, f, b);
        }
Example #4
0
        public static void Stroke(this IConsoleBuffer buffer, int x, int y, int width, int height, char vertSideToken, char horizSideToken, char ulToken, char urToken, char llToken, char lrToken, ConsoleColor f)
        {
            if (buffer is null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }

            buffer.Stroke(x, y, width, height, vertSideToken, horizSideToken, ulToken, urToken, llToken, lrToken, f, buffer.GetBackgroundColor(x, y));
        }