Moving with a character in ASCII ART
Dec 3, 2013 at 6:30pm UTC
Hey I'm a student and I have a little problem. I don't know how I can navigate with a character in an txt file. Some people said to me that I must use GetAsyncKeyState
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
int main ()
{
SetWindow(170,60);
string line;
ifstream myfile ("images/Megahero.txt" );
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file" ;
cout<<" \nPress any key to continue\n" ;
cin.ignore();
cin.get();
system("cls" );
intro();
return 0;
}
void SetWindow(int Width, int Height)
{
_COORD coord;
coord.X = Width;
coord.Y = Height;
_SMALL_RECT Rect;
Rect.Top = 0;
Rect.Left = 0;
Rect.Bottom = Height - 1;
Rect.Right = Width - 1;
HANDLE Handle = GetStdHandle(STD_OUTPUT_HANDLE); // Get Handle
SetConsoleScreenBufferSize(Handle, coord); // Set Buffer Size
SetConsoleWindowInfo(Handle, TRUE, &Rect); // Set Window Size
}
void world()
{
string line;
ifstream myfile ("images/map.txt" );
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file" ;
}
Topic archived. No new replies allowed.