I am attempting to create a console-based library for games.
I have classes that fill a two-dimensional array with background-foreground-character values, and then my code iterates through that array to write the symbols. (This is so I can have multiple colors).
This is what I believe to be the only relevant part of the code:
for (int y = 0; y < chars.GetLength(1); y++)
{
for (int x = 0; x < chars.GetLength(0); x++)
{
Character chr = chars[x, y];
Console.ForegroundColor = chr.ForeGround;
Console.BackgroundColor = chr.BackGround;
Console.Write(chr.Symbol.ToString());
}
Console.BackgroundColor = ConsoleColor.Black;
Console.Write("\n");
}
However, the output looks like this:
There are small lines at the bottom and at the right, as well as the large black square presumably where the scroll bar would normally be. The scrollbar itself isn't visible, as I've changed the buffer size of the console window to be the same as the screen size, like so:
public Game(string name, Size size, Scene[] scenes)
{
this.name = name;
Console.Title = name;
this.scenes = scenes;
this.currentScene = scenes[0];
this.size = size;
Console.SetWindowSize(size.Width, size.Height);
Console.SetBufferSize(size.Width, size.Height);
Render();
Console.ReadKey();
}
Is there any way of getting rid of those color anomalies? The only way I've personally found is by printing black background at the edges, but this would result in my game being awkwardly offset from the center.