This is a question of about design decisions. I find that there are so many different things I work on where reading a
_kbhit() is amazingly useful but I can't find (read: there isn't) any functionality like that in the C++ standard.
- Example: Have a camera continuously running (and updating an on-screen window) until you hit the "escape" character.
- Example: Pressing F11 in firefox to maximize the window.
- Example: Pressing the W key in any FPS game to move forwards
All of these read the keyboard without pressing [enter] between each read. How the devil is that accomplished? Under windows I use
getch() in a continuous loop running in its own thread. I'm not sure if that's a good idea performance-wise, but most of the software I write that runs in an OS isn't very time critical (It's mostly command-line UIs that interface with the embedded systems that I develop).
This is for a UI for a system, and the UI has to run under Linux. How do you read a keyboard hit without calling a