Example #1
0
        public void Clear(BufferLayers layer)
        {
            Console.Clear();

            _chixels = new Chixel[layerCount][, ];
            for (int i = 0; i < _chixels.Length; i++)
            {
                _chixels[i] = new Chixel[Width, Height];
            }
        }
Example #2
0
        public Chixel GetChixel(Vector2 pos, BufferLayers layer)
        {
            pos.X -= _left;
            pos.Y -= _top;
            if (pos.X < 0 || pos.X >= Width || pos.Y < 0 || pos.Y >= Height)
            {
                //throw new Exception();
                return(null);
            }

            return(_chixels[(int)layer][pos.X, pos.Y]);
        }
Example #3
0
        public void Write(Vector2 pos, string s, BufferLayers layer, ConsoleColor fgColor = ConsoleColor.White, ConsoleColor bgColor = ConsoleColor.Black)
        {
            int initX = pos.X;

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == '\n')
                {
                    pos.X = initX;
                    pos.Y++;
                    continue;
                }

                SetChixel(pos, s[i], layer, fgColor, bgColor);
                pos.X++;
            }
        }
Example #4
0
        public void SetChixel(Vector2 pos, char c, BufferLayers layer, ConsoleColor fgColor = ConsoleColor.White, ConsoleColor bgColor = ConsoleColor.Black)
        {
            pos.X -= _left;
            pos.Y -= _top;

            if (pos.X < 0 || pos.X >= Width || pos.Y < 0 || pos.Y >= Height)
            {
                return;
            }

            Chixel ch = _chixels[(int)layer][pos.X, pos.Y];

            if (ch != null && ch.Glyph == c && ch.ForgroundColor == fgColor && ch.BackgroundColor == bgColor)
            {
                return;
            }

            _chixels[(int)layer][pos.X, pos.Y] = new Chixel(c, fgColor, bgColor);
        }
Example #5
0
 public void RemoveChixel(Vector2 pos, BufferLayers layer)
 {
     SetChixel(pos, '\0', layer);
 }
Example #6
0
 public void SetChixel(Vector2 pos, Chixel chixel, BufferLayers layer)
 {
     SetChixel(pos, chixel.Glyph, layer, chixel.ForgroundColor, chixel.BackgroundColor);
 }