I'm currently writing a little snake game in the console to get used to c++ but I can't seem to find a good way to get arrow key inputs without pausing the console. does anyone know a way I could get arrow key inputs and not have the console pausing?
Asked
Active
Viewed 30 times
0
-
no because this pauses my game because it waits for an input and doesn't allow the game to continue running. I need a solution that allows everything to continue. (I was thinking maybe some kind of callback function so the waiting for an input can be done while the program is running. – BasJ Apr 04 '20 at 15:19
-
You might be able to try threading. – Apr 04 '20 at 15:29
-
I don't have much experience with that and neither do I have much c++ experience but i will try it. It seems like it would be a good solution. – BasJ Apr 04 '20 at 15:35
-
1It has worked!!! I have just put the code that looks for the input in a separate function and made a thread at the beginning which executes this function and when the function is done it just calls itself again. It worked like a charm. – BasJ Apr 04 '20 at 16:11