I'm trying to make a c++ snake game in linux using ansi escape codes but i can't figure out a way to get async keyboard input. Im a beginner and i'm currently reading a c++ book, so i didn't cover multithreading yet. Is there any chance to achieve this result in a "simple" way.(and standard if it's possible, i saw the kbhit solution) How to use kbhit and getch (C programming) . Can i solve the problem reading from the /dev/input event files?
Thank you guys.
/dev/inputis linux-specific, so it's not even remotely standard.std::asyncorstd::threadbut that doesn't look it's what you're actually asking.