Within the function DrawMap the MAP_BUFFER parameter is used to determine the
values written into the GUI_BUFFER local variable. Discuss briefly the relationship between these data structures by explaining how the contents of an element of the MAP_BUFFER array determines the contents of the GUI_BUFFER array.
// Set the ScreenBuffer characters and attributes given the ENTITY values in rMap
for (unsigned int row = 0; row < MAP_HEIGHT; row++)
{
for (unsigned int col = 0; col < MAP_WIDTH; col++)
{
ENTITY & rTile = rMap[row][col];
rScreenBuffer[row][col].Char.AsciiChar = (char)TOKEN[rTile];
switch (rTile)
{
case EMPTY:
rScreenBuffer[row][col].Attributes = 0;
break;
case WALL:
rScreenBuffer[row][col].Attributes = FOREGROUND_WHITE;
break;
};
}
}
// Copy the ScreenBuffer content to the standard output console
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdOut != INVALID_HANDLE_VALUE)
{
COORD pos = { 0, 0 };
COORD size = { MAP_WIDTH, MAP_HEIGHT };