Ejemplo n.º 1
0
        public void Write(string text, ConsoleColor?background = null, ConsoleColor?foreground = null)
        {
            var startingX = currentXPosition;

            foreach (var c in text)
            {
                if (c == '\n')
                {
                    IncrementY();
                    currentXPosition = startingX;
                    continue;
                }

                if (c == '\t')
                {
                    IncrementX(3);
                    continue;
                }

                renderableDots[currentYPosition][currentXPosition] = new RenderableDot
                {
                    Character  = c,
                    Background = background ?? ConsoleColor.Black,
                    Foreground = foreground ?? ConsoleColor.White,
                };

                IncrementX();
            }
        }
Ejemplo n.º 2
0
        public RenderableDotGenerator(int width, int height)
        {
            renderableDots = new RenderableDot[height][];
            for (int y = 0; y < height; y++)
            {
                renderableDots[y] = new RenderableDot[width];
            }

            this.width  = width;
            this.height = height;
        }