Displaying 2D array faster
I've been displaying my game map (which draws only what is contained in the bounding box) like so (C#):
In the "little math problem" thread (which was deleted) Bubba mentioned that there is a better way to display the map, using only one loop.
// X, Y, Width, Height
Rectangle rect = new Rectangle(1, 1, 3, 3);
char[,] map = new char[10, 10];
for (int x = 0; x < map.GetLength(0); x++)
for (int y = 0; y < map.GetLength(1); y++)
map[x, y] = '#';
// Only draw the part of the map that is contained in the bounding box.
for (int x = rect.Left; x < rect.Right; x++)
for (int y = rect.Top; y < rect.Bottom; y++)
So does anyone know how that method (or others) works to draw a map faster than the current method I use?
Any help is appreciated.