So I recently found curses (specifically PDcurses) and I'm just getting into it. Right now I'm trying to write a little space shooter type game with it and it's worked fine so far for rendering and getting menu type input, but now when I go into the game, I've noticed that key repeat is pretty bad for action games. I need to be able to hold the key and move my avatar every single frame that the key is down. I know how to do this with a normal Win32 application, but I don't have a window and therefore I don't have a wndproc and I can't control the messages the console recieves :/
I don't expect this is something for curses to handle, though if it can that would be awesome, I was really just looking for a work-around that plays nicely with curses.
I have tried cbreak(), nodelay() and raw() to no avail.
Additional info:
- Microsoft Visual Studio 2010 Ultimate
- PDcurses 3.4, from prebuilt binaries
- Windows 7 x64 Ultimate
This is far from a complete solution, and I don't know how it'll interact with PDCurses, but it's an attempt:
In summary, grab the console's handle with
GetStdHandle()
, configure it for raw reading withSetConsoleMode()
, and then read keys one at a time withReadConsoleInput()
. I use astd::set
to keep track of the currently pressed keys and so ignore repeats.