I'm making a game in C++ on Windows using the Console, which involves a turn-based battle. I'm using the Sleep()
function to delay messages in the battle, which then advances when a key is hit. My problem is that while the game is "paused" by the sleep function, it still counts the user's key presses, and then starts using them.
For instance, if a user presses the "a" key four times while the game is sleeping, it will keep using that key press four times, long after it has been pressed.
How do I temporarily "turn off" the ability for the user's key presses to register with the program?