Making a new game, graphic.
Code:
main()
{
char map[10][10], mapcolor[10][10];
int j, end;
HANDLE h;
h = GetStdHandle ( STD_OUTPUT_HANDLE );
for(int i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
map[i][j] = (char)178;
}
}
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
mapcolor[i][j] = 1;
}
}
for(i=4;i<7;i++)
{
for(j=4;j<7;j++)
{
mapcolor[i][j] = 3;
}
}
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
switch(mapcolor[i][j])
{
case 1:
SetConsoleTextAttribute (h, FOREGROUND_BLUE);
cout<<map[i][j];
break;
case 3:
SetConsoleTextAttribute (h, FOREGROUND_GREEN);
cout<<map[i][j];
break;
default:
SetConsoleTextAttribute (h, FOREGROUND_RED);
cout<<map[i][j];
break;
}
}
cout<<"\n";
}
cin>>end;
return 0;
}
this is not working for me. It compiles and runs, but when it prints every box is the same color. what am i doing wrong? thanx in advance :-P