How to have two console cursors in C++?

Viewed 110

I'd like the user to be able to type in the console as standard, but also have the code continuously write characters to the console (comparable to updating frames). The issue I found with this is it moves where the user is typing.

In a given example where the user should write to the bottom left of the screen but the code is writing characters to the top right (by moving the console cursor and using std::cout), some of the users' characters will appear at the top right.

I'm wondering if it's possible to have two console cursors, essentially for writing in two locations at once (or an emulation of this behavior)? This would allow one to handle the user input, and the other can write to the rest of the console.

My only other idea was to detect the user pressing keys and write them to the console the same way I am with the other text, but this causes me to have to handle things such as backspacing, arrows, etc.

If you have any other suggestions on how this could be done, I'd appreciate hearing them.

0 Answers
Related