1.

Solve : not using cin??

Answer»

Im making a game in C++, and I need something to the effect of: if(ButtonPressed(Left)){DoThis();} Got any ideas?Like, instead of the user having to TYPE "L" and then press ENTER, being able to just press the left arrow key? Any way to do this in C++?GetAsyncKeyState()Not got a chance to try it yet, but if it WORKS (and I dont doubt it will)... Thank you, thank you, thank you, and thank you again!it is a windows API function. you will need to include "windows.h".

If you aren't USING windows, we'll need to reevaluate your problem. Perhaps the C library getch() function?Right now, i am using windows, but later i might want to port to linux and the like, so... What about getch?well; I don't have a lot of EXPERIENCE with C/C++... have you tried any reference manuals? (look for getkey or getch or something)Anybody have any idea what value to pass to GetAsyncKeyState() ?a virtual key code constant- also defined in windows headers.

for example- VK_LEFT would be left arrow key.



Discussion

No Comment Found