Problem mit Cursor Bewegung
-
Hallo Community.
Ich versuche gerade einen Buchstaben in der Console Bewegen zu lassen.Leider ist mein Problem das er 1. nicht richtig positioniert wird 2. nur einmal sich bewegt
Hier ist der Code :
int input; int x=0, y=0, y_last=0, x_last=0; while(true){ input = _getch(); ///UP if(input == 72) { if(y == 0) { setCursorPos(x,0); std::cout << " \0"; y_last = y+1; setCursorPos(x,y_last); std::cout << "#\0"; } if(y != 0) { y_last = y-1; setCursorPos(x,y_last); std::cout << " \0"; y = y_last+2; setCursorPos(x,y); std::cout << "#\0"; } } ///DOWN else if(input == 80) { if(y == 0) { setCursorPos(x,0); std::cout << " \0"; y_last = y-1; setCursorPos(x,y_last); std::cout << "#\0"; } if(y != 0) { y_last = y+1; setCursorPos(x,y_last); std::cout << " \0"; y = y_last-2; setCursorPos(x,y); std::cout << "#\0"; } }
-
Ok hab das ganze gelöscht und nochmal von vorne angefangen und habs jetzt.