Hi,
I am programming my first game framework in c++ and I have a console where I print debug info. Now I want to be able to introduce commands. The problem is that I dont know how to get the console input without pausing the main game loop. How can I do it? Do I need to separate it in another thread?
Thanks.
From reading this, I can't tell if you're talking about outputting to the OS's console, or a shell, or if you have a custom graphical console within the application's window.
If the former, as mentioned, you could try kbhit() in Windows, or using termio in *nix, or something else like that.
If the latter, you could poll for input if you determine that the console has focus, and filter out the key presses that you want into a line buffer, before submitting it for parsing.
Neither of these solutions require a separate thread, but if you really, really want to, you can spend a thread on it.