I want to make a game where you move around (still within the command line) how do I take the immediate key press (I do know the ascii value of the keys) I don't even know where to start
btw I made the matrix(no not the movie either :P) *sigh
I tried AsyncKeyState but it outputs 0 for all keys Microsoft gave the following reasons for that:
Windows NT/2000/XP: The return value is zero for the following cases:
* The current desktop is not the active desktop
* The foreground thread belongs to another process and the desktop does not allow the hook or the journal record.
I'm about to try ReadConsoleInput now
I just tried it and it didn't compile
I added windows.h this time and it returned this error code:
`__stdcall__' attribute only applies to function types
`__in' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
`__out' undeclared (first use this function)
initializer expression list treated as compound expression
int c = 0;
int b;
constchar *i;
while (c != 4){
b = keyReader(i); // renamed your original function
c++; // sorry not intentional
cout << c << " : " << b << endl;
}
cmd("pause"); // hehe new idea that replaces system :)
The only down side is that I can't update my game because it's on my laptop :(
But thank you for the help :)
it is a function that when called checks if it is string pause then runs your code ....
I made the function you made the code :)
1 2 3 4 5 6
int cmd (string typeCommandHere){
if (typeCommandHere == "pause"){
cout << "Press ENTER to continue...";
cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
}
}