getch() reagiert zu langsam -.-
-
Aha, Danke für den CODE

Jetzt sehe ich, dass du viele if-Abfragen hast und in
jeder stecken 2 getch().
D.h. Das Programm hält bei jedem getch() an, wartet
auf eine Tastatureingabe, wartet auf die zweite, usw...
wäre es da nicht sinnvoller, so etwas auszuprobieren:http://www.c-plusplus.net/forum/viewtopic-var-t-is-199893-and-highlight-is-.html
Bitte ausprobieren und Erfolg melden!

-
Liegt glaub ich am Puffer, der nach getch gelöscht wird aber kA.
So gehts jedenfalls:while(true) { if(_kbhit()) // Wenn irgendeine Taste gedruckt... { char input = _getch(); // ...dann eben diese einlesen... switch(input) // ...und auswerten... { case 41: case 48: // ... break; case 42: case 83: // ... break; default: std::cout << "Taste nicht zugewiesen" << std::endl; } } }MfG
-
Allgemein gilt dabei zu beachten, wie im letzten Posting auch getan, das _getch() eine blockierende Funktion ist. Daher ist der erste gepostete Codeschnipsel ziemlich unpraktisch wenn nicht sogar unsinnig.

-
hi
und wieso kann ich mit der mit dem cursor nicht ganz rauf?hier download link zur main.exe:
http://uploaded.to/?id=7got4zbitte um schnelle hilfe
lg
ps hab auf versehen in ansi c thread geschrieben sry
-
???????????????????? KANN MIR BITTE JMD HELPEN?
-
langsam schrieb:
hi
und wieso kann ich mit der mit dem cursor nicht ganz rauf?Wenn du deine Frage nochmal verständlich formulierst und den /Quellcode/ postest versuche ich dir zu helfen
-
darthdespotism schrieb:
langsam schrieb:
hi
und wieso kann ich mit der mit dem cursor nicht ganz rauf?Wenn du deine Frage nochmal verständlich formulierst und den /Quellcode/ postest versuche ich dir zu helfen
char input; const int xch = 10; const int ych = 20; int x = xch; int y = ych; gotoxy(x, y); while(true) { input = _getch(); if(input == 119 || input == 87) //D { gotoxy(x,y - 1); } else if(input == 65 || input == 97) // D { gotoxy(--x, y); } else if(input == 115 || input == 83) // D { gotoxy(x, ++y); } else if(input == 68 || input == 100) // D { gotoxy(++x, y); } else { std::cout << "Taste nicht gefunden."; gotoxy(++x, ++y); } }und wieso kann ich mit der mit dem cursor nicht ganz rauf tun?
danke im vorus!!!
mfg
-
bitte hilfet mir
-
quellcode ist nicht ein teil des quellcodes und auch nicht nur bruchstücke. quellcode ist ganzer quellcode.
in deinem teil steht nur die verschiebung, wenn du hilfe bei den abfragen der maximalwerte willst poste entsprechenden part oder das ganze
-
#include <iostream> #include <windows.h> #include <ctime> #include <string> #include <vector> #include <cmath> #include <conio.h> #include <stdio.h> int main() { char input; const int xch = 10; const int ych = 20; int x = xch; int y = ych; gotoxy(x, y); while(true) { input = _getch(); if(input == 119 || input == 87) //D { gotoxy(x,y - 1); } else if(input == 65 || input == 97) // D { gotoxy(--x, y); } else if(input == 115 || input == 83) // D { gotoxy(x, ++y); } else if(input == 68 || input == 100) // D { gotoxy(++x, y); } else { std::cout << "Taste nicht gefunden."; gotoxy(++x, ++y); } } return 0; }das ist der ganze.
-
#include <iostream> #include <windows.h> #include <ctime> #include <string> #include <vector> #include <cmath> #include <conio.h> #include <stdio.h> int main() { char input; const int xch = 10; const int ych = 20; int x = xch; int y = ych; gotoxy(x, y); while(true) { input = _getch(); if(input == 119 || input == 87) //D { gotoxy(x,--y);// <--------- } else if(input == 65 || input == 97) // D { gotoxy(--x, y); } else if(input == 115 || input == 83) // D { gotoxy(x, ++y); } else if(input == 68 || input == 100) // D { gotoxy(++x, y); } else { std::cout << "Taste nicht gefunden."; gotoxy(++x, ++y); } } return 0; }tut mir leid wenn ich dir jetzt zu nahe trete aber: Stefan Stauß?
-
Ja, wieso?