Sorry to derail the thread, but this is something I’ve been trying to figure out forever, with no success.
About the awaiting-a-single-character-mode, does anyone here have any idea how to get the Windows console into non-blocking read mode for stdin? In Posix we have file descriptors and stdin is FD 0, so we can do something like:
fcntl(0, F_SETFL, O_NONBLOCK) and now stdin is non-blocking and we can poll it without hanging the program. Then just use
raw from curses so it’s sending input immediately instead of waiting for enter. This kind of setup seems perfect for roguelike games.
How the heck do you do this on Windows?
Apparently the Windows equivalent of the curses stuff is SetConsoleMode, but I’ve had no luck finding something equivalent to
fcntl (there is something for sockets, but I’m not sure it’s useful).