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]; } }
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]); }
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++; } }
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); }
public void RemoveChixel(Vector2 pos, BufferLayers layer) { SetChixel(pos, '\0', layer); }
public void SetChixel(Vector2 pos, Chixel chixel, BufferLayers layer) { SetChixel(pos, chixel.Glyph, layer, chixel.ForgroundColor, chixel.BackgroundColor); }