1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
void ClearScreen()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD count;
DWORD cellCount;
COORD homeCoords = { 0, 0 };
if (wHnd == INVALID_HANDLE_VALUE) return;
/* Get the number of cells in the current buffer*/
if (!GetConsoleScreenBufferInfo( wHnd, &csbi )) return;
cellCount = csbi.dwSize.X *csbi.dwSize.Y;
/* Fill the entire buffer with spaces*/
if (!FillConsoleOutputCharacter(
wHnd,
(TCHAR) ' ',
cellCount,
homeCoords,
&count
)) return;
/* Fill the entire buffer with the current colors and attributes*/
if (!FillConsoleOutputAttribute(
wHnd,
csbi.wAttributes,
cellCount,
homeCoords,
&count
)) return;
/* Move the cursor home*/
SetConsoleCursorPosition( wHnd, homeCoords );
COORD coordScreen = { 0, 0 };
}
int locy = 3;
int locx = 3;
char house [33][72] = {
{"PPPPPPPPPPPPPPPPPPP-------------------MMMMMM-MMMMMMMMMMMMMMMMMMMMMMMMMM"},
{"PP-PPPPPPP------PPPPPPPP--------------MMMMMM--MMMMMMMMMMMMMMMMMMMM/ \\MM"},
{"PPPPPPPPP---/ \\---PPPPPPP---------------MMMMM---MMMMMMMMMMMMMMMMMM| |MM"},
{"PPPPPPPPPP--| |----PPPPPPP-------------MMMMMMMM--MMMMMMMMMMMMMMMM--MMMM"},
{"PPPPPPPPPPPP---PPPPPPPPP-----------------MMMMM------MMMMMMMMMMMMMMMMMMM"},
{"PPPPPPPPPPPPP-PPPP------------------------MM--------------MMMMMMMMMMMMM"},
{"PPPPPPPP--------------------------------------------------------MMMMMMM"},
{"PPPPPPPPPP-------------------------------------------------------------"},
{"PPPPPP---------------------------------------------------------^^------"},
{"PPP--------------MMM------------------------------------------^ ^-----"},
{"-------------~~~~~~~MM-------------/ \\-----------------------^^ ^^----"},
{"------------~~~~~~~~~~MM-----------| |---------------------------------"},
{"-----------~~~~~~~~~~~~M-----------------------------------------------"},
{"------------~~~~~~~~~MM----------------------------------~~~~~~~~~~----"},
{"--------------~~~~~~M-----------------------------------~~~~~~~~~~~~PP-"},
{"----------------MMMM-----------------------------------~~~~~~~~~~~~~~P-"},
{"-------------------------------------------------------~~~~~~~~~~~~~~PP"},
{"--------------------------------------------------------~~~~~~~~~~~~PP-"},
{"------------^^--------------------------------------PPPP-~~~~~~~~~~-PPP"},
{"-----------^ ^-----------------------------------PPPPPPP-~~~~~~~~-PPPP"},
{"----------^^ ^^---------------------------PPPPPPPPPPPPPPPPPPPPPPPPPPPP"},
{"---------------------------------------------PPPPPPPPPPPPPPPPPPPPPPPPP-"},
{".....-------------------------------/ \\-------PPPPPPPPPPPPPPPPPPPPPPP--"},
{"........----------------------------| |------PPPPPPPPPPPPPPPPPPPPPPPPP-"},
{"...........--------------------------------------PPPPPPPPPPPPPPPPPPPPPP"},
{".............-----------------------------------PPPPPPPPPPPPPPPPPPPPPPP"},
{"..............---------------------------------PPPPPPPPPPPPPPPPPPPPPPPP"},
{"...............-----------------------------------PPPPPPPPPPPPPPPPPPPPP"},
{"..~...........-------------------------------------PPPPPPPPPPPPPPPPPPPP"},
{".~~~...........-----------^^---------------------------PPPPPPPPPPPPPPPP"},
{"..~.............---------^ ^--------------------------------PPPPPPPPPP"},
{"...............---------^^ ^^------------------------------PPPPPPPPPPP"},
};
void House(){
int x = 0;
int y = 0;
ClearScreen();
do{
if(y == locy && x == locx){
SetConsoleTextAttribute(wHnd, FOREGROUND_RED);
cout << 'Q';
}
else {
if (house[y][x] == '~'){
SetConsoleTextAttribute(wHnd, FOREGROUND_BLUE|FOREGROUND_INTENSITY);
}
else if(house[y][x] == 'P'){
SetConsoleTextAttribute(wHnd, FOREGROUND_GREEN);
}
else if(house[y][x] == 'M'){
SetConsoleTextAttribute(wHnd, FOREGROUND_RED|FOREGROUND_BLUE);
}
else if(house[y][x] == '.'){
SetConsoleTextAttribute(wHnd, FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY);
}
else{
SetConsoleTextAttribute(wHnd, FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED);
}
cout << house[y][x];
}
x++;
if(x == 71 && y != 31){
cout << endl;
x = 0;
y++;
}
}
while(x != 71 && y !=42);
}
| |