i’m making a console game but i don’t want the system to wait every time i tell it to detect a press (like cin)… Does anyone know how i can get a console window to detect keyboard presses, its ok if it’s just letter key detection too, i can make do!
Share
If it’s Windows, the kbhit( ) function is the guy you want. If it’s *nix, here’s a kbhit( ) emulator. kbhit( ) returns immediately (no blocking) with a flag that says that there is or is not a keyboard character waiting to be read. You can test the flag to see if you should issue a keyboard read.