Hello people and sorry for my english.
I have un problem on my little game console, found mysterious word.
When my count thread has finished, for me it should show me the response request but remain pending until the enter key is pressed.
if anyone has an idea I am more than interested because I believe I have been around the internet and nothing has been found to solve my problem.
I made a loop to prevent the player from typing on the keyboard and being taken as a bad answer from him. I couldn't see a way to count down and prevent wrong entry (I tried with a for but it supported keyboard input). I hope to have been clear. Anyway thank you for your answers.
It seems that you want to consume characters entered while clavierEtei ("isKeyboardOn") is false. You are trying to do this in the main thread like this:
1 2
while (!isKeyboardOn)
std::cin.ignore();
The problem is that ignore() blocks and is also generally line-buffered.
On Windows you might try doing this with _kbhit() and _getch().
On *nix you might try doing it with simulations of those functions.
_kbhit() tells if a character is waiting in the input buffer.
_getch() reads (and removes) a character from the buffer.