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
|
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <iostream>
int gridz(int x, int y,char array[]);
int refresh(int x, int y,char array[]);
int main(void)
{
int dummy,x=0,y=0;
char array[80][26];
// for(x = 0 ; x<25; x++)
// {
gridz(x,y,array);
//}
const WORD colors[] = {0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F,0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6};
HANDLE hstdin = GetStdHandle( STD_INPUT_HANDLE );
HANDLE hstdout = GetStdHandle( STD_OUTPUT_HANDLE );
WORD index = 0;
SetConsoleTextAttribute( hstdout, 0x7f );
x=2;
y=20;
char up='w';
char dir;
std::cin>>dir;
switch(dir)
{
case 'w':
x=x-80;
array[x][y] =printf("A");
array[x-1][y] =printf("#");
refresh(x,y,array);
break;
case 'a':
x=x-1;
array[x][y] =printf("<");
array[x-1][y] =printf("#");
break;
case 's':
x=x+80;
array[x][y] =printf("V");
array[x-1][y] =printf("#");
break;
case 'd':
x=x+1;
array[x][y] = printf(">");
array[x-1][y] = printf("#");
break;
}
refresh(x,y,array);
scanf("%d",&dummy);
return 0;
}
int gridz(int x, int y,char array)
{
const WORD colors[] = {0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F,0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6};
HANDLE hstdin = GetStdHandle( STD_INPUT_HANDLE );
HANDLE hstdout = GetStdHandle( STD_OUTPUT_HANDLE );
WORD index = 0;
SetConsoleTextAttribute( hstdout, 0x7f );
for(x = 0 ; x<=80; x++)
{
array[x][y] ='x';
array[x][y]=printf(" ");
for(y = 0 ; y<=26; y++)
{
array[x][y] ='y';
array[x][y]=printf(" ");
}
}
}
int refresh(int x, int y,char array1[],char array2[])
{
const WORD colors[] = {0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F,0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6};
HANDLE hstdin = GetStdHandle( STD_INPUT_HANDLE );
HANDLE hstdout = GetStdHandle( STD_OUTPUT_HANDLE );
WORD index = 0;
SetConsoleTextAttribute( hstdout, 0x7f );
for(x = 0 ; x<80; x++)
{
array[x][y] ='x';
array[x][y]=printf(" ");
for(y = 0 ; y<26; y++)
{
array[x][y] ='y';
array[x][y]=printf(" ");
}
}
}
| |